Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
"Change cumulative to periodic values
Hello
in power bi I have a table that is cumuative, so i want to write a measure to change it to periodical value. i want to have last column ( Yellow Column)"
Solved! Go to Solution.
Hi, @MrDarian
Based on your description, I created data to reproduce your scenario. The sample pbix file is attachded in the end.
Table:
You may create a calculated column or a measure as below.
Periodic Amount Column =
var _lastamount =
CALCULATE(
SUM('Table'[Cumnlative Amount]),
FILTER(
ALL('Table'),
'Table'[Title ID] = EARLIER('Table'[Title ID])&&
'Table'[Month ID] = EARLIER('Table'[Month ID])&&
'Table'[Week ID] = EARLIER('Table'[Week ID])-1
)
)
return
IF(
ISBLANK(_lastamount),
'Table'[Cumnlative Amount],
'Table'[Cumnlative Amount]-_lastamount
)
Periodic Amount Measure =
var _lastamount =
CALCULATE(
SUM('Table'[Cumnlative Amount]),
FILTER(
ALL('Table'),
'Table'[Title ID] = SELECTEDVALUE('Table'[Title ID])&&
'Table'[Month ID] = SELECTEDVALUE('Table'[Month ID])&&
'Table'[Week ID] = SELECTEDVALUE('Table'[Week ID])-1
)
)
return
IF(
ISBLANK(_lastamount),
SELECTEDVALUE('Table'[Cumnlative Amount]),
SELECTEDVALUE('Table'[Cumnlative Amount])-_lastamount
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @MrDarian
Based on your description, I created data to reproduce your scenario. The sample pbix file is attachded in the end.
Table:
You may create a calculated column or a measure as below.
Periodic Amount Column =
var _lastamount =
CALCULATE(
SUM('Table'[Cumnlative Amount]),
FILTER(
ALL('Table'),
'Table'[Title ID] = EARLIER('Table'[Title ID])&&
'Table'[Month ID] = EARLIER('Table'[Month ID])&&
'Table'[Week ID] = EARLIER('Table'[Week ID])-1
)
)
return
IF(
ISBLANK(_lastamount),
'Table'[Cumnlative Amount],
'Table'[Cumnlative Amount]-_lastamount
)
Periodic Amount Measure =
var _lastamount =
CALCULATE(
SUM('Table'[Cumnlative Amount]),
FILTER(
ALL('Table'),
'Table'[Title ID] = SELECTEDVALUE('Table'[Title ID])&&
'Table'[Month ID] = SELECTEDVALUE('Table'[Month ID])&&
'Table'[Week ID] = SELECTEDVALUE('Table'[Week ID])-1
)
)
return
IF(
ISBLANK(_lastamount),
SELECTEDVALUE('Table'[Cumnlative Amount]),
SELECTEDVALUE('Table'[Cumnlative Amount])-_lastamount
)
Result:
Best Regards
Allan
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
hello, thanks for your response, is it possible to do in my real data in the link below?
@MrDarian , Create a new column as
period Amount =
table[cumulative Amount] - maxx(filter(table, table[title ID] = earlier(table[title ID]) && table[cumulative Amount] < earlier(table[cumulative Amount] )),table[cumulative Amount] )
it does'nt work
My DAX Formula:
period Amount =
'Weekly Performance'[SPerformanceAmount]
- MAXX (
FILTER (
'Weekly Performance',
'Weekly Performance'[SRefActionId]
= EARLIER ( 'Weekly Performance'[SRefActionId] )
&& 'Weekly Performance'[SPerformanceAmount]
< EARLIER ( 'Weekly Performance'[SPerformanceAmount] )
),
'Weekly Performance'[SPerformanceAmount]
)
@MrDarian or use following DAX expression to create a Column, change Table and Column names as per your model:
Periodic Value =
VAR __currValue = **bleep**[Column1]
VAR __prevValue =
CALCULATE (
MAX ( **bleep**[Column1] ),
ALLEXCEPT ( **bleep**, **bleep**[Id] ),
**bleep**[Column1] < __currValue
)
RETURN __currValue - __prevValue
I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
It does'nt work
My DAX for Column:
@MrDarian please share pbix file with sample data to further look into it. Remove any sensitive information before sharing.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
100 | |
77 | |
74 | |
49 |
User | Count |
---|---|
146 | |
108 | |
106 | |
90 | |
62 |