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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

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

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

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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