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

The FabCon + SQLCon recap series starts April 14th at 8am Pacific. If you’re tracking where AI is going inside Fabric, this first session is a can't miss. Register now

Reply
minimynt
Frequent Visitor

DAX Last Year Sales

Hi,

 

I want to create LY Sales calculation, but somehow there's something wrong with the result.

The total of LY Sales is right, but I don't have any idea why LY sales for each year is not showing.

Untitled.png

Here is my formula

LY Sales = CALCULATE([Total Sales], DATEADD(Orders[Order Date],-1,YEAR))

Does anybody know why? 😞

 

 

Thanks,

Priscilla

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hello, try this instead: LY Sales = CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Orders'[Order Date]))

 

If you have a dedicated date table, you'll want to use the date column from there instead of Order Date

View solution in original post

@Anonymous Hi, I've also tried with SAMEPERIODLASTYEAR but the result is the same. However, I just figured out that only continuous date is valid for this case and my OrderDate isn't continuous so that's why.

 

Thanks anyway! 🙂

View solution in original post

6 REPLIES 6
sure19
Helper II
Helper II

Hi,

first i have filtered year, then inserted region and sales, when i try to use the above to calculate last year sales, it gives me blank.  is it because i have already filtered the year?  how can i still show last year sales against this year sales?

 

thanks in advance

 

Suresh

vicks
Frequent Visitor

Hi Suresh;

 

Did you solved your problem?, i have same issue about that, the formula didnt worked when i filtered by Year;

i have single fact table with sales measure, person dimension, Year, Month, Date(dateSQL) Dimension;

 

warm regards;

 

Opik

Anonymous
Not applicable

Is your date column continuous? If you're using a seperate date table, did you create the relationship using 2 fields with a Date data type?

Anonymous
Not applicable

Hello, try this instead: LY Sales = CALCULATE([Total Sales], SAMEPERIODLASTYEAR('Orders'[Order Date]))

 

If you have a dedicated date table, you'll want to use the date column from there instead of Order Date

@Anonymous Hi, I've also tried with SAMEPERIODLASTYEAR but the result is the same. However, I just figured out that only continuous date is valid for this case and my OrderDate isn't continuous so that's why.

 

Thanks anyway! 🙂

Anonymous
Not applicable

Hi Guys, 

I know it's quite irritating to get the prior year meaures. I tried looking everywhere left with no choice than to try all by myself. Please find the solution below 

LY Sales = CALCULATE([Total Sales],Calender[Year] = YEAR(TODAY()) - 1)

Total Sales = Your measure 
Calender = Your date table
I am just subtracting 1 from the current years number in this expression YEAR(TODAY()) - 1). 
Please accept it as a solution if it resolved your issue

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

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.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

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