Hi,
I calculated Cumulative Sales and Cumulative Sales PY in 2 different ways, one called Revenue (worked fine) the other one called Sales (not working as expected for PY only).
Cumulative Revenue =
CALCULATE( [Revenue],
FILTER( ALLSELECTED( ‘Calendar’ ),
‘Calendar’[Date] <= MAX( ‘Calendar’[Date] ) ))
Sales PY =
CALCULATE(
[Revenue], DATEADD(‘Calendar’[Date],-1,YEAR))
Cumulative Revenue PY =
CALCULATE( [Sales PY],
FILTER( ALLSELECTED( ‘Calendar’ ),
‘Calendar’[Date] <= MAX( ‘Calendar’[Date] ) ))
Cumulative Sales =
VAR LastSalesDate = CALCULATE( MAX( ‘Calendar’[Date] ), ALL( ‘Calendar’) )
RETURN
IF( SELECTEDVALUE( ‘Calendar’[Date] ) > LastSalesDate, BLANK(),
CALCULATE( [Revenue],
FILTER( ALLSELECTED( ‘Calendar’[Date] ),
‘Calendar’[Date] <= MAX( ‘Calendar’[Date] ))))
Cumulative Sales PY =
CALCULATE(
[Cumulative Sales],
SAMEPERIODLASTYEAR(‘Calendar’[Date])
)
Moreover I which one should I always use over the other from a simplicity and performance standpoint.
Thanks a lot