Forum Discussion
YTD
Hi
I am trying to get the YTD totals from the previous year and cannot see to get it to work. I have read extensively online and my Date table has no gaps and was created using CALENDARAUTO.
My problem is that I have created the measure below that basically calculates the volumes up until the last delivery date with the fiscal year set to 31.3.
YTD VOLUME = CALCULATE([VOLUME], DATESYTD('DATE'[Date],"31/3"),
FILTER(SALESLINE,SALESLINE[DEPOT] = "UK"),
FILTER(SALESLINE,SALESLINE[DELIVERY DATE] <= LASTDATE('DATE'[Date])))
Then I have called SAMEPERIODLASTYEAR to get the corresponding volumes hoewever I get the entire 12 months and not April to Last delivery date as expected.
SAME LY = CALCULATE([YTD VOLUME], SAMEPERIODLASTYEAR('DATE'[Date]))
I have tried numerous other funtions like PARRELLPERIOD but I am convinced SAMEPERIODLASTYEAR is the correct one and should work.
Thanks
9 Replies
- Vander1981New Member
Hi,
Try this :
YTD VOLUME =
CALCULATE ( [VOLUME], DATESYTD ( 'DATE'[Date], "31/3" ) )LYTD VOLUME =
VAR LastDateInFact =
CALCULATE ( LASTDATE ( FACT[Date] ) , ALL(FACT) ) which is the last date available in your fact table.
RETURN
TOTALYTD (
[VOLUME],
SAMEPERIODLASTYEAR (
FILTER ( VALUES ( 'DATE'[Date] ), 'DATE'[Date] <= LastDateInFact )
),
"31/3"
)
- QualubeHelper II
Thank you very much for the reply, the variable works however it still returns the fulkl 12 months and I only want April to Today as a comparison.
- Vander1981New Member
That's because in your fact table you have data up to march 19 right ?
If it is the case you should adapt the variable to display only the last date of sales.