Search code examples
powerbidaxcumulative-sum

Cumulative values in Power BI


I'm trying to use the following code to calculate the cumulative sum in Power BI:

cumulative = CALCULATE(SUM(test[Number]),ALL('test'),test[Date] <= MAX(test[Date]))

However, as you can see in the picture, the result is summing up everything and not by cumulative per date.

I did some research, and apparently, the formula is not wrong.

strong text


Solution

  • Try this.

    cumulative = 
    
    VAR d = test[Date] 
    
    RETURN CALCULATE(SUM(test[Number]),ALL('test'),test[Date] <=d)