Forum Discussion
Difference in cummulative total
- 6 years ago
You will need to find out the next to last date. So your variable
VAR MaxDate = MAX ( 'Balance'[new_date] )is fine. You can use that as follows:
VAR varMaxDate = MAX( Dates[Date] ) VAR varNextToMaxDate = MAXX( FILTER( ALL( Dates[Date] ), Dates[Date] < varMaxDate ), Dates[Date] )So in my little sample table, varMaxDate is April 1, and varNextToMaxDate is March 15. You can then use the varNextToMaxDate to calculate the previous total.
So perhaps another variable that calculates that previous total, then just do the math: varMaxValue - varPreviousDateValue.
CALCULATE ( [Total Payment Amount], 'Balance'[new_date] = varNextToMaxDate, ALL ( Balance ) )But I'd need to see some data to tinker with the filtering. I think your ALL() statement takes care of that but you'd need to test.
You will need to find out the next to last date. So your variable
VAR MaxDate = MAX ( 'Balance'[new_date] )
is fine. You can use that as follows:
VAR varMaxDate =
MAX( Dates[Date] )
VAR varNextToMaxDate =
MAXX(
FILTER(
ALL( Dates[Date] ),
Dates[Date] < varMaxDate
),
Dates[Date]
)
So in my little sample table, varMaxDate is April 1, and varNextToMaxDate is March 15. You can then use the varNextToMaxDate to calculate the previous total.
So perhaps another variable that calculates that previous total, then just do the math: varMaxValue - varPreviousDateValue.
CALCULATE (
[Total Payment Amount],
'Balance'[new_date] = varNextToMaxDate,
ALL ( Balance )
)
But I'd need to see some data to tinker with the filtering. I think your ALL() statement takes care of that but you'd need to test.