Forum Discussion
Nikki
Helper II
9 years agocumulative sum
hi there i have a table called "financials". in financials there is a field called "month" (which is a date field), i also have a $ field which is called "actuals". i want to create a stacked column...
- 9 years ago
MEASURE 1
Running Total = CALCULATE ( SUM ( financials[actuals] ), FILTER ( ALLSELECTED ( financials ), financials[month] <= MAX ( financials[month] ) && MIN ( financials[month] ) <= TODAY () ) )Measure 1 will give you the RT up to today - however you may still overshoot a bit if there's no data for the current month.
So to address this you may want to use Measure 2.
MEASURE 2
Running Total 2 = IF ( MIN ( financials[month] ) <= CALCULATE ( LASTDATE ( financials[month] ), FILTER ( ALLSELECTED ( financials ), financials[actuals] <> BLANK () ) ), CALCULATE ( SUM ( financials[actuals] ), FILTER ( ALLSELECTED ( financials ), financials[month] <= MAX ( financials[month] ) ) ) )Good Luck! :smileyhappy:
BhaveshPatel
Super User
9 years agoHi Nikki,
Please refer this DAXPATTERNS BLOG for the complete patterns of calculating cumulative total. It is one of hte most widely used formula in DAX and can solve many complex problems.