Forum Discussion
Roseventura
Responsive Resident
7 years agoCumulative Total Goes Back Too Far
I have data that goes back to 1/1/2017, but I'm trying to create cumulative totals ONLY for 2018 and 2019. The cumulative measure for 2019 works fine and starts accumulating on 1/1/19 as expected, b...
Anonymous
7 years agoNot applicable
HI Roseventura ,
You can consider to add if statement to compare current date from row contents, break cumulative rolling if it is less than particular date.
Regards,
Xiaoxin Sheng
Roseventura
Responsive Resident
7 years agoI understand what you are saying conceptually, but could you give me an example using my calculations?
Rose
- Anonymous7 years agoNot applicable
HI Roseventura ,
You can try to use following measure if it works on your side:
Cumulative Sales LY = VAR LastSalesDate = CALCULATE ( LASTDATE ( PBI_AEP_Shipments_Multi[Formatted Transaction Date] ), ALL ( PBI_AEP_Shipments_Multi ) ) VAR _currDate = MAX ( PBI_FSCAPF[PADDATE] ) RETURN IF ( SELECTEDVALUE ( PBI_FSCAPF[PADDATE] ) > LastSalesDate, BLANK (), IF ( YEAR ( currDate ) > 2018, CALCULATE ( [Sales LY], FILTER ( ALLSELECTED ( PBI_FSCAPF ), PBI_FSCAPF[PADDATE] <= MAX ( PBI_FSCAPF[PADDATE] ) ) ), CALCULATE ( [Sales LY], FILTER ( ALLSELECTED ( PBI_FSCAPF ), PBI_FSCAPF[PADDATE] <= MAX ( PBI_FSCAPF[PADDATE] ) && YEAR ( PBI_FSCAPF[PADDATE] ) = YEAR ( currDate ) ) ) ) )If above not help, can you please share some sample data for test? You can create some fake data upload to onedrive or google drive then share link here.
Notice: do mask on sensitive data.
Regards,
Xiaoxin Sheng