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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Syndicate_Admin
Administrator
Administrator

Problem with SAMEPERIODLASTYEAR

Good morning

I have a chart in which I show all the printing expenses that my company has since January 2020.

I would like to calculate the total for the same period (January-June) but last year.

Using this formula still gives me error.

Total previous year period = CALCULATE(SUM('Printer Expenses'[Total(€)]),SAMEPERIODLASTYEAR(Calendar[Date]))
Can anyone help me?
Thank you!
3 REPLIES 3
Syndicate_Admin
Administrator
Administrator

I'm sorry but I don't calculate it well either, it gives me the total of the previous year but not as I want, from January to June.

Does anyone know how it works?

Hi @Syndicate_Admin 

 

What visuals do you put this measure in? Measures are calculated according to the context they are in, so we need to take care of the effect other columns in the same visual may have.

 

Regards,
Community Support Team _ Jing

amitchandak
Super User
Super User

@Syndicate_Admin ,

This seems like fine

Total previous year period = CALCULATE(SUM('Printer Expenses'[Total(€)]),SAMEPERIODLASTYEAR(Calendar[Date]))

 

try like Total previous year period = CALCULATE(SUM('Printer Expenses'[Total(€)]),dateadd(Calendar[Date],-1,year))

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.