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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
SPa
Frequent Visitor

Create Card that will show the dates from the previous period last year

Hi all, 

 

Probably dead simple, just can't get it to work. I have the following measure that will display the date range nicely when added to a card. 

 

Measure 1 Result
January 2023 - June 2023
 

Measure 1 Code

Report Period FORMAT = FORMAT(FIRSTDATE('Dates'[Date]), "MMMM YYYY") & " - " & FORMAT(LASTDATE('Dates'[Date]), "MMMM yyyy")
 
What I need is the same, but from the previous year:
 
Measure 2 Desired Result
January 2022 - June 2022
 

Measure 2 Code

?
 
I'm assuming I need to use Sameperiodlastyear, but my attempts have failed
1 ACCEPTED SOLUTION
SPa
Frequent Visitor

Managed to solve it! 

 

Report Period FORMAT last year = 

FORMAT(FIRSTDATE(SAMEPERIODLASTYEAR('Dates'[Date])), "MMMM YYYY") & " - " & FORMAT(LASTDATE(SAMEPERIODLASTYEAR('Dates'[Date])), "MMMM YYYY")

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Hi @SPa ,

I am glad to hear your problem has been resolved, please kindly mark it as the solution. More people will benefit from it.

Thanks for your efforts & time in advance.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

DOLEARY85
Resident Rockstar
Resident Rockstar

Hi,

 

You could try this:

 

Report Period FORMAT last year =
 var _lastyear = YEAR (
        CALCULATE ( MIN ( Dates[Date] ), ALLSELECTED (Dates[Date] ) )-1
    )

    return
FORMAT(FIRSTDATE('Dates'[Date]), "MMMM") & " " & _lastyear & " - " & FORMAT(LASTDATE('Dates'[Date]), "MMMM") & " " & _lastyear
 
DOLEARY85_0-1691004396404.png

 

If I answered your question, please mark my post as solution, Appreciate your Kudos 👍

SPa
Frequent Visitor

Managed to solve it! 

 

Report Period FORMAT last year = 

FORMAT(FIRSTDATE(SAMEPERIODLASTYEAR('Dates'[Date])), "MMMM YYYY") & " - " & FORMAT(LASTDATE(SAMEPERIODLASTYEAR('Dates'[Date])), "MMMM YYYY")

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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

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.

Users online (6,349)