cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
satishkurra Frequent Visitor
Frequent Visitor

Calculate Last Year Sales based on Max function in DAX

Hi

 

I'm currently using below expression for YTD Sales. The reason i used Max here is user can slice based on Year selection dynamically

 

vEngYearYTD = CALCULATE(
SUM(Raw_New[Engagement Revenue]),
FILTER('Link',Link[Fiscal Year]=[vMaxYear]),
FILTER('Raw_New',Raw_New[Date]<=[vMaxDate])
)
 
vMaxYear = Max(Link[Fiscal Year])
vMaxDate = Max(Raw_New[Date])
 
Now i want to compare the same period last year. I do not want to use same period last year as it goes only year back.
 
Thanks
Satish
3 REPLIES 3
GauravSingh Regular Visitor
Regular Visitor

Re: Calculate Last Year Sales based on Max function in DAX

Try this:

 

 

 

Same Period Last Year = CALCULATE([YTD measure], PARALLELPERIOD('Report - New Cut In'[Date], -12,MONTH))

satishkurra Frequent Visitor
Frequent Visitor

Re: Calculate Last Year Sales based on Max function in DAX

This works if no year selected from slicer. But if we select year, it is blank. The reason is we are using Max in YTD Measure

Community Support Team
Community Support Team

Re: Calculate Last Year Sales based on Max function in DAX

Hi @satishkurra 

 

It seems you may change the formula with Link[Fiscal Year]=[vMaxYear]-1 to get last year.Here is the similar post for your reference.If it is not your case,sample data and expected output will be helpful to provide an accurate solution.Please share the .pbix file.You can upload the .pbix file to OneDrive and post the link here. Do mask sensitive data before uploading.

 

Regards,
Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.