Forum Discussion
Qualube
7 years agoHelper II
SAMEPERIODLASTYEAR()
Hi I have created a measure as below which gives me the total sales from the 1st April up to today TOTALSALES = CALCULATE(SUM(SALES[LINEAMOUNT]), FILTER(SALESLINE,SALESLINE[Depot] = "Dep...
- 7 years ago
Hi Qualube,
The SAMEPERIODLASTYEAR needs a Date context. But the previous measure can't provide that. How did you use the measure? Please try the measure like below.
TOTALSALES = CALCULATE ( SUM ( SALES[LINEAMOUNT] ), FILTER ( SALESLINE, SALESLINE[Depot] = "Depot 1" ), DATESBETWEEN ( SALESLINE[DELIVERY DATE], DATE ( 2017, 4, 1 ), EDATE ( TODAY (), -12 ) // "today" of last year. ) )Best Regards,
Dale
v-jiascu-msft
7 years agoMicrosoft Employee
Hi Qualube,
The SAMEPERIODLASTYEAR needs a Date context. But the previous measure can't provide that. How did you use the measure? Please try the measure like below.
TOTALSALES =
CALCULATE (
SUM ( SALES[LINEAMOUNT] ),
FILTER ( SALESLINE, SALESLINE[Depot] = "Depot 1" ),
DATESBETWEEN (
SALESLINE[DELIVERY DATE],
DATE ( 2017, 4, 1 ),
EDATE ( TODAY (), -12 ) // "today" of last year.
)
)
Best Regards,
Dale
Qualube
7 years agoHelper II
Hi Dale
Sorry for the delay, the EDATE works (not sure why but I will find out).
Thanks for your help.