Forum Discussion
Running Total solution for slicer
- 6 years ago
Ok. I played with this some more. Please try this expression. Having account in both the table and the slicer makes this a challenge.
RunningTotal = var thisdate = CALCULATE(MAX(Total[Date]), ALLSELECTED(Total[Account]))return CALCULATE(SUM(Total[Amount]), ALLEXCEPT(Total,Total[Account]), Total[Date] <= thisdate)Regards,
Pat
Try writing a new measure that references the original measure. This one will iterate over each account and add all of the running totals together. See if that works instead. Typing on a tablet. Sorry.
New = Sumx(values(table[account]), [original measure])
If not will look more later.
Pat
Thanks Pat, but still getting same result, 😞
I just returned the original formula for running total and created the new measure, but it gives same numbers
- mahoneypat6 years agoMicrosoft Employee
The reason you are seeing the weird #s is because the max date for Account 102 is less than the max for Account 101. You need to get the max date in the selected month in the variable first with this type of change.
RunningTotalAll = var thisdate = CALCULATE(MAX(Total[Date]), ALL(Total), VALUES(Total[Month]))return CALCULATE(SUM(Total[Amount]), ALL(Total), Total[Date]<= thisdate)Regards,Pat- cpdanielmc216 years agoHelper I
Hi Pat, thanks. I think is closer.
It shows 24 for Month 1 and 62 for Month 2, (indeed correct), but not showing the "development" of 10, 20, then 24, then 39, etc up until 62.
Also, if let's say I filter Account 102, should get 12, but get 62. In this case the original measure is the correct
- mahoneypat6 years agoMicrosoft Employee
Ok. I played with this some more. Please try this expression. Having account in both the table and the slicer makes this a challenge.
RunningTotal = var thisdate = CALCULATE(MAX(Total[Date]), ALLSELECTED(Total[Account]))return CALCULATE(SUM(Total[Amount]), ALLEXCEPT(Total,Total[Account]), Total[Date] <= thisdate)Regards,
Pat