Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jmeccles
Helper I
Helper I

How to Determine Same Period Specific Year

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.

1 ACCEPTED SOLUTION
selimovd
Super User
Super User

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 regards
Denis
 

 

View solution in original post

5 REPLIES 5
mahoneypat
Microsoft Employee
Microsoft Employee

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

 





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not 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.

This is brilliant. But can you do the same with Same Day of Week ? instead of Date vs Date ? Please help.

Anonymous
Not 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!

selimovd
Super User
Super User

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 regards
Denis
 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.