Forum Discussion

jsteffe's avatar
jsteffe
Helper III
4 years ago
Solved

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 :
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
  • Can you share your file with shorten data? I want to see what's your date format.

2 Replies

Replies have been turned off for this discussion
  • Can you share your file with shorten data? I want to see what's your date format.

  • PaulDBrown's avatar
    PaulDBrown
    Community Champion

    Try:

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