Forum Discussion
Difference betweeen two cummulative values
- 6 years ago
Hi, Anonymous , Anonymous
First of all, thanks for the quick responses. It have been useful.
Anonymous. I tried phormula you said and it shows an error. I think it's because Cummulative Quantity is a measure in the model, instead of a colum.
Anonymous. The phormula you said works, except for the phormula to calculate 'Cumul Qty'.
So, I have changed phormula por Cumul Qty and it works.
Cummulative Quantity = CALCULATE(SUM(Sales[Quantity]);FILTER(ALL('Calendar'); 'Calendar'[Date] <= MAXX('Calendar';'Calendar'[Date])))Diff = [Cummulative Quantity] - CALCULATE( [Cummulative Quantity]; FIRSTDATE( 'Calendar'[Date] ) )And it works.....
Thanks
Hi Angel ,
1. Create a Calculated Column (this is to get the Cumulative Totals of the Previous Date)
Demoted CQ =
VAR maxi =
CALCULATE (
MAX ( Data1[Cummulative Quantity] ),
FILTER ( ALL ( Data1 ), Data1[Date] < EARLIER ( Data1[Date] ) )
)
VAR mini =
CALCULATE (
MIN ( Data1[Cummulative Quantity] ),
FILTER ( ALL ( Data1 ), Data1[Date] = MIN ( Data1[Date] ) )
)
RETURN
IF ( Data1[Date] = MIN ( Data1[Date] ), mini, maxi )
2. Create a Calculated Column (This Calculates the Difference between the Cumulative Totals)