admin管理员组文章数量:1289836
Within PowerBI, I have a table with many stock tickers with weights, across many dates. I'm trying to calculate a day over day change but can't seem to create a calculated column and/or structure the data in way that let's me do so. The target is the column on the very right (the day over day difference) but I'm fine with calculating the PreviousDay column in an effort to obtain the difference more easily.
Ticker | Date | Weight | PreviousDay | Difference from PreviousDay |
---|---|---|---|---|
AAPL | 2/11/2025 | 9.72% | 10.50% | -0.78% |
CSX | 2/11/2025 | 5.32% | 4.00% | 1.32% |
JNJ | 2/11/2025 | 1.88% | 2.00% | -0.12% |
NKE | 2/11/2025 | 2.42% | 4.00% | -1.58% |
AAPL | 2/10/2025 | 10.50% | 12.00% | -1.50% |
CSX | 2/10/2025 | 4.00% | 6.00% | -2.00% |
JNJ | 2/10/2025 | 2.00% | 5.00% | -3.00% |
NKE | 2/10/2025 | 4.00% | 6.00% | -2.00% |
AAPL | 2/7/2025 | 12.00% | ||
CSX | 2/7/2025 | 6.00% | ||
JNJ | 2/7/2025 | 5.00% | ||
NKE | 2/7/2025 | 6.00% |
Within PowerBI, I have a table with many stock tickers with weights, across many dates. I'm trying to calculate a day over day change but can't seem to create a calculated column and/or structure the data in way that let's me do so. The target is the column on the very right (the day over day difference) but I'm fine with calculating the PreviousDay column in an effort to obtain the difference more easily.
Ticker | Date | Weight | PreviousDay | Difference from PreviousDay |
---|---|---|---|---|
AAPL | 2/11/2025 | 9.72% | 10.50% | -0.78% |
CSX | 2/11/2025 | 5.32% | 4.00% | 1.32% |
JNJ | 2/11/2025 | 1.88% | 2.00% | -0.12% |
NKE | 2/11/2025 | 2.42% | 4.00% | -1.58% |
AAPL | 2/10/2025 | 10.50% | 12.00% | -1.50% |
CSX | 2/10/2025 | 4.00% | 6.00% | -2.00% |
JNJ | 2/10/2025 | 2.00% | 5.00% | -3.00% |
NKE | 2/10/2025 | 4.00% | 6.00% | -2.00% |
AAPL | 2/7/2025 | 12.00% | ||
CSX | 2/7/2025 | 6.00% | ||
JNJ | 2/7/2025 | 5.00% | ||
NKE | 2/7/2025 | 6.00% |
Hoping my example makes sense but if not please let me know. Appreciate any help. Thanks.
Share Improve this question asked Feb 20 at 0:50 bigjdawg43bigjdawg43 1831 gold badge1 silver badge10 bronze badges1 Answer
Reset to default 0you can try this
PreviousDay2 =
VAR _last =
MAXX (
FILTER (
'Table',
'Table'[Ticker] = EARLIER ( 'Table'[Ticker] )
&& 'Table'[Date] < EARLIER ( 'Table'[Date] )
),
'Table'[Date]
)
RETURN
IF (
ISBLANK ( _last ),
BLANK (),
MAXX (
FILTER (
'Table',
'Table'[Ticker] = EARLIER ( 'Table'[Ticker] )
&& 'Table'[Date] = _last
),
'Table'[Weight]
)
)
difference =
IF (
ISBLANK ( 'Table'[PreviousDay2] ),
BLANK (),
'Table'[Weight] - 'Table'[PreviousDay2]
)
本文标签: PowerBI Day over Day changeStack Overflow
版权声明:本文标题:PowerBI Day over Day change - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741463695a2380186.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论