Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello,
Just as SAMEPERIODLASTYEAR can change the context of a measure to parallel dates last year, is there a way that I can calculate a meaure in the context of a very specific year -- e.g. 2019?
This means the meaure would work exactly as SAMEPERIODLASTYEAR, adjusting to all filter contexts, except that it would be relative to the specific year.
Solved! Go to Solution.
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
)
)
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
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.
This is brilliant. But can you do the same with Same Day of Week ? instead of Date vs Date ? Please help.
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!
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
)
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 38 | |
| 36 | |
| 28 | |
| 28 |
| User | Count |
|---|---|
| 124 | |
| 89 | |
| 73 | |
| 66 | |
| 65 |