Forum Discussion
How to Determine Same Period Specific Year
- 5 years ago
Hey jmeccles ,
yes, you can use the function PARALLELPERIOD to get an individual period.
So you could do:
MyParallelMeasure = CALCULATE( [MyMeasure], PARALLELPERIOD( Datetable[Date], -2, YEAR ) )If you need any help please let me know.If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍Best regardsDenisBlog: WhatTheFact.biFollow me: twitter.com/DenSelimovic
You can dynamically calculate the years from 2019 in a variable ( e.g., YEAR(MAX(Date[Date])) - 2019 ), and then use that within PARALLELPERIOD inside a CALCULATE as suggested by selimovd
Pat
- Anonymous4 years agoNot applicable
Thanks for the tip with the dynamic calculation mahoneypat - I had to create a negative value for the interval, and I used DATEADD (for some reason PARALLELPERIOD returned a BLANK value).
Anyway, this is what it looks like for me, in case it helps anyone:
DATEADD ( DateTable[Date],
CALCULATE ( ( YEAR ( MAX ( DateTable[Date] ) ) - 2019 ) * ( -1 ) ),
YEAR )This creates a dynamic time interval, always referencing back from the current date to the same period in 2019. Very handy for "Pre-COVID19" calculations.
- Mihail3 years agoRegular Visitor
This is brilliant. But can you do the same with Same Day of Week ? instead of Date vs Date ? Please help.
- Anonymous3 years agoNot applicable
Hi Mihail,
sorry, I was OOO until today. The function should also work when you replace "YEAR" with "DAY" for a day-to-day comparison. This will reference to the exact day, not a corresponding weekday, however.
Can you give me an example or some Code (also if it is not working) as to what precisely you are trying to compare. Just make sure to conceil any sensitive information!