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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
wsindharta
Helper I
Helper I

Calculate cumulative YOY different, if missing date then select the last date

Hi, 

 

can anyone help me with DAX. 

 

this is the actual data i have

wsindharta_1-1675867907214.png

i need help to create a measure that if user choose the date it will calculate the different of cummulative quantity sold between selected date and previous year. example if user select the december 2022, it will pick 3500 (from november 2022, because december 2022 not available)  - 1785 (from december 2021) 

 

another example to make it clear : if user choose august 2022, so it will pick 3150 (from may 2022) - 350 (From march 2021)

 

totally blank on how to achieve that, i create cummulative using calculated column. 


thanks

 

regards,

Sind

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@wsindharta , Are looking for YTD over YTD ?

 

 

eith help from date table

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

diff = [YTD Sales]-[Last YTD Sales]
diff % = divide([YTD Sales]-[Last YTD Sales]],[Last YTD Sales])

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@wsindharta , Are looking for YTD over YTD ?

 

 

eith help from date table

 

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd('Date'[Date],-1,Year),"12/31"))

 

diff = [YTD Sales]-[Last YTD Sales]
diff % = divide([YTD Sales]-[Last YTD Sales]],[Last YTD Sales])

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.