Forum Discussion
Anonymous
6 years agoNot applicable
Calculate difference with cumulative total
I have a dataset that has a running total (cumulative total) but need to be able to create a column that tracks the difference by date and category. Everything I've found online seems to show how to ...
- 6 years ago
Hi Anonymous ,
You can download my proposed solution from here.
Here is the formula for Value Savings:
Value savings = var currentDate = SELECTEDVALUE(Savings[Date]) var priorDate = CALCULATE(LASTDATE('Savings'[Date]), ALLEXCEPT('Savings','Savings'[uniqueID]),'Savings'[Date]<currentDate) RETURN SUM('Savings'[Cumulative Savings]) - CALCULATE(SUM('Savings'[Cumulative Savings]), ALLEXCEPT('Savings',Savings[uniqueID]), 'Savings'[Date]=priorDate)this is how the formula works:
first, it finds the current date
second, it finds the prior date for the same uniqueID
finally, it calculates the difference between the cumulated savings on the current date and the cumulated savings on the prior date.
Here is a screenshot of the final result:
Does this help you?
LC
Interested in Power BI and DAX tutorials? Check out my blog at www.finance-bi.com
Anonymous
6 years agoNot applicable
lc_finance
Solution Sage
6 years agoWonderful!
Do not hesitate if you have any more questions,
LC