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
satishkurra
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
Anonymous
Not applicable

Try this:

 

 

 

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

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

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.

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.

Top Solution Authors