Forum Discussion
Anonymous
10 years agoNot applicable
Cumulative (Running) Totals in DAX
A common Measure that you’ll probably find useful in PowerPivot or SSAS Tabular Models is finding running totals. For example, you may want to see total sales of a product as it accumulates over tim...
- Anonymous10 years ago
Give the following a try:
Cumulative Sales:=IF(MIN(DimDate[Datekey])<=CALCULATE(MAX(FactSales[DateKey]),ALL(FactSales)),CALCULATE([Total Sales],FILTER(All(DimDate[Datekey]),DimDate[Datekey]<=MAX((DimDate[Datekey])))),BLANK())
Please mark it as a solution or give a kudo if it works for you, otherwise let me know if you run into an issue and I'll do my best to assist.
Thanks,
james_m
7 years agoFrequent Visitor
Best solution:Running Total =
VAR RunningTotal= CALCULATE([Amount], FILTER(ALL(DimDate), DimDate[Full Date]<=MAX(DimDate[Full Date])))
RETURN IF(COUNTROWS(FctTable), RunningTotal)