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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
seabrew
Helper II
Helper II

SAMEPERIODLASTYEAR - Charting with Month End Values

I have a aggregated month end value to show along with the aggregated month end of the prior year's month value. These are not cumulative values, we need to show what the value is at the end of each month with that same value 12 months ago. 

 

I have the calendar table setup correctly. 

 

The issue I am having is that I can only get the SAMEPERIODLASTYEAR value to work if I am using the default date hierarchy on my datekey calendar field.

 

If I remove year and/or quarter the prior value is the same as the current value which I understand is likely because DAX is evaulating the period without a year or quarter context. The only way I can get the prior value to work at the month level on a bar chart is to drill down from year -> month -> quarter. The problem with this is that I need to see more than three months at a time. 

 

How do I display several month values in this formula without being locked into three months in a particular quarter? 

 

Here are my measures

 

TotalValues = SUM(AccountSecurityMonthEndValues[Value])

Prior Year Values = CALCULATE([TotalValues], SAMEPERIODLASTYEAR('Calendar'[DateKey]))

 

This is what it looks like when I drill down to month with the date hierarchy intact. Again, this is correct, but I need to show more months than those within a current quarter. 

 

powerbi1.png

 

 

 

 

 

 

 

1 ACCEPTED SOLUTION
Vvelarde
Community Champion
Community Champion

@seabrew

 

hi, you can go to next level with the icon with double arrow and Concatenate to X Axis to OFF

 

ConcatenateX.gif




Lima - Peru

View solution in original post

4 REPLIES 4
Vvelarde
Community Champion
Community Champion

@seabrew

 

hi, you can go to next level with the icon with double arrow and Concatenate to X Axis to OFF

 

ConcatenateX.gif




Lima - Peru

@Vvelarde - Thank you! Expand all worked!

 

One more question if you don't mind. How do you change the date format of the X axis from being grouped by Year/Quarter/Month to just showing the MM/YYYY? Changing the format of the DateKey field in my calendar table doesn't do anything. 

 

powerbi2.png

Vvelarde
Community Champion
Community Champion

@seabrew

 

if you are using the Date Herarchy i think the most closer to this is removing the Quarter of the Herarchy and Concatenate is ON.

 




Lima - Peru

Thank you! This is much closer to what I was looking for. 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors