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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jsteffe
Helper III
Helper III

Problem with previousYear function

I gest these 2 measures :

total_of_sales = SUM(Order_details[total_without_discount])
Total_sales_previous_year = CALCULATE([total_of_sales],PREVIOUSYEAR('Calendar'[Date]))
 
I don't understand why when I want to presnet my results by year and buy month it doesn't work :
ex.png
In my second table, I would like to get the total of sales for last year month by month and Power BI calculates the total of sales for year 1996 (see photo).
 
Thanks for your help,
 
Jérôme
1 ACCEPTED SOLUTION
linh091
Resolver I
Resolver I

Can you share your file with shorten data? I want to see what's your date format.

View solution in original post

2 REPLIES 2
PaulDBrown
Community Champion
Community Champion

Try:

Total_sales_previous_year = CALCULATE([total_of_sales], DATEADD('Calendar'[Date], -1, YEAR))





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






linh091
Resolver I
Resolver I

Can you share your file with shorten data? I want to see what's your date format.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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