Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
10 years ago
Solved

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...
  • Anonymous's avatar
    Anonymous
    10 years ago

    sdjensen

     

    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,

    Ryan Durkin