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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

YTD difference between 2 dates

Dear All

 

I'm just trying to create a line chart by week that shows a punctual difference between 2 dates and the related YTD.

 

For the punctual calculation we succeed using also an holiday calendar. Here below the Dax

 

Ricevimento odv - inserimento CO = 
VAR Ricevimento = MAX('2019'[Data ricevimento odv])
VAR Inserimento = MAX('2019'[Data documento])
RETURN CALCULATE(SUM('CALENDAR'[is work day]),
FILTER(ALL('CALENDAR'[Solar Date]),
'CALENDAR'[Solar Date] >= Ricevimento
&& 'CALENDAR'[Solar Date] <=Inserimento))

 

The problem is that the cumulated is not working:

 

Ricevimento Odv - invio CO cumulated = calculate([Ricevimento odv - invio CO],filter(ALLSELECTED('Calendar'),'CALENDAR'[Solar Date]<=MAX('2019'[Data ricevimento odv])))

 

Here below the relationship between tables and the graph that is not working (the red line)

graph Marc1.png

 

graph marc2.png

Any idea?! 

Thanks a lot for your help!!!!

 

Zeno

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , have tried using use relation with datesytd

 

like this example

YTD 1 = CALCULATE(SUM('CALENDAR'[is work day]),DATESYTD('Date'[Date],"12/31"),USERELATIONSHIP('Table'[Date1];CALENDAR[Date]))

YTD 2 = CALCULATE(SUM('CALENDAR'[is work day]),DATESYTD('Date'[Date],"12/31"),USERELATIONSHIP('Table'[Date2];CALENDAR[Date]))
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

@Anonymous , have tried using use relation with datesytd

 

like this example

YTD 1 = CALCULATE(SUM('CALENDAR'[is work day]),DATESYTD('Date'[Date],"12/31"),USERELATIONSHIP('Table'[Date1];CALENDAR[Date]))

YTD 2 = CALCULATE(SUM('CALENDAR'[is work day]),DATESYTD('Date'[Date],"12/31"),USERELATIONSHIP('Table'[Date2];CALENDAR[Date]))
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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.