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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
hsalasde
Regular Visitor

Previous Year Calculations

Hello, 

 

I'm attempting to calculate Previous Year measures using SAMEPARIODLASTYEAR & by using Filsters. In both instances, the calculations are wrong. The data shows that the calculations made by Power BI are off by a day. The period for the current year is calculated from Sunday through Saturday. The Previous Year calculation is calculating from the previous Saturday through Friday. I've looked through board to find a solution, but I'm stumped. 

 

Here are my two different calculations which are giving the same result. 

 
Using DATESINPERIOD: 
PY Weekend Surg Mins w/ Filter =
CALCULATE(
    [Weekend Surg Mins],
    FILTER(
        DATESINPERIOD(
            'Date'[Date],
            DATEADD(
                LASTDATE('Date'[Date]),
                -1,
                YEAR
            ),
            -7,
            DAY
        ),
        WEEKDAY('Date'[Date], 1) IN {2,6,7,1}
    )
)
 
Using SAMEPERIODLASTYEAR:
PY Weekend Surg Mins =
CALCULATE(
    [Weekend Surg Mins],
    SAMEPERIODLASTYEAR('Date'[Date])
    )
 
Any help would be most appreciated! 
 
Manual ReviewManual ReviewPower BI Table OutputPower BI Table Output
 
 
1 REPLY 1
Greg_Deckler
Community Champion
Community Champion

@hsalasde You may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000

Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.

https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...

 

This video has a number of different solutions that might help:



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.