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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

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
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

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

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.