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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

Difference between two dates - from two different tables

I am trying to calculate our on time performance.   Date due  vs  date shipped. 

 

I have a date table.   The relationship between Flu Shipped and the date table is with "Date Shipped"   and on the Orders table the relationship is with the Due Date.  

 

I need find the difference between these two dates.   

 

Annotation 2020-01-23 205052.png

4 REPLIES 4
v-lid-msft
Community Support
Community Support

Hi @Anonymous ,

 

Do you want to calculate the difference between the "Flu shipped " Table and "Orders" Table? Does the "Flu shipped" Tables and "Order" Tables have relationships in logic? What is the connective column they have if they have relation, such as ID column?


Best regards,

 

 

Community Support Team _ Dong Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi, make a new relationship on those columns and that new relationship will not be "active".

so you have to add the syntax in your measure/columns "USERELATIONSHIP"

 

https://docs.microsoft.com/sv-se/dax/userelationship-function-dax

 

 

and then in your measure you type this syntax: 

=CALCULATE(SUM(InternetSales[SalesAmount]), USERELATIONSHIP(InternetSales[ShippingDate], DateTime[Date]))

 

Hope this can help you 🙂

 

/Adam

 

Anonymous
Not applicable

Hi, 

 

Sorry to a noob.   But create a relationship between my date table and these?  I have that already.  

 

Or just create a relationhip, between the order table and the shipping table?   If so, from which field to which field?   And won't this be a many to many relationship?

I tried to create a Data model that can refer to your data model. Please find this pbix, where I created 4 ways how can you get date diff from two different tables.

I created a common dim, Date dim. Common dim for date diff. The date dim just for your ref.

I also populated dates from one table to another to get date diff.

 

https://www.dropbox.com/s/y47ah38sr157l7t/Oder_delivery.pbix?dl=0

 

Let me know if this can solve your purpose.

 

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.