Reputation: 151
I'm trying to create a YTD DAX statement that gives me the parallel period from last year until a specific date.
Currently I have :
SumQty = SUM('Order Table'[Quantity])
YTD LY = CALCULATE([SumQty];PARALLELPERIOD('DIM Dates'[Date];-12;MONTH))
But this calculates me values for the whole last year instead of from January till August(now)
So in the end i need a Table which shows me the Qunatity of every month compared to the quantity last year in the same time period.
Any ideas?
Upvotes: 0
Views: 565
Reputation: 118
In order to get the table you specified, you need to create 2 YTD measures:
Current YTD = CALCULATE ( [SumQty]; DATESYTD ( 'DIM Dates'[Date] ) )
PY YTD = CALCULATE ( [SumQty]; DATEADD ( DATESYTD ( 'DIM Dates'[Date] ); -1; YEAR ) )
Then use a matrix visualization and put measures [Current YTD] and [PY YTD] under Values section and 'DIM Dates'[Year] and 'DIM Dates'[Month] (I suppose you have them in your DIM Dates table) under Lines section.
That would give you the following table:
Please remember to have your 'DIM Dates' relationship to the 'Order Table' correctly configured in order to have your time intelligence calculations done right. You can find more info here.
Upvotes: 0