Forum Discussion
Nikki
9 years agoHelper II
cumulative 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:
Sean
9 years agoCommunity Champion
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: