How to calculate running total of a measure

Viewed 39

I have this measure

Average Spend =
CALCULATE ( SUM ( Table[Spend] ) ) / CALCULATE ( SUM ( Table[Volume] ) )

The table has a variable month that the data is grouped by

Month  Spend   Customers  var_x   var_y
1      100       20        A       C
2      300       40        A       B
3      500       50        A       C

I want to have a graph showing running total spend per customer, so x axis would be month and y axis would be average_spend

Any ideas?

1 Answers

Plain vanilla:

Go to Quick Measure, select Running total and pull in your measure and the Month column. That's it.

enter image description here

The result will look like this:

enter image description here

And here's the expression that Power BI created for you:

Average Spend running total in Month = 
CALCULATE(
    [Average Spend],
    FILTER(
        ALLSELECTED('Table'[Month]),
        ISONORAFTER('Table'[Month], MAX('Table'[Month]), DESC)
    )
)
Related