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
nafitycs
New Member

how to calculate Date diff measure from two different tables date field which is transformed into Tx

Hello, I am a new bee. What is the DAX formula to measure and find out the date difference by using two dates from two different tables? I want the date difference Order Date . from the Sales table and the Delivery Date from the Sales Orders Sheet. Appreciate your help. How can I attached a file for you guys to see the problem?

Thanks

nafitycs_0-1718126910496.png

 

1 ACCEPTED SOLUTION
rajendraongole1
Super User
Super User

Hi @nafitycs -Calculating the date difference between the "Order Date" from the Sales table and the "Delivery Date" from the Sales Orders table. I hope there is a relationship exist between two tables (Sales table and the Sales Orders table) with common field.

 

Using calculated column,you can see the report in Table view or data view.

 

DateDifference =
DATEDIFF(
Sales[Order Date],
RELATED('Sales Orders'[Delivery Date]),
DAY
)

 

With measure also works if you are performing on aggregations and you can see value in report view.

 

DateDifferenceMeasure =
VAR OrderDate = SELECTEDVALUE(Sales[Order Date])
VAR DeliveryDate = RELATED('Sales Orders'[Delivery Date])
RETURN
DATEDIFF(OrderDate, DeliveryDate, DAY)

 

 

Hope it works. please check

 

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
nafitycs
New Member

@rajendraongole1 Thank you

HI @nafitycs  Happy to Help!!

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





rajendraongole1
Super User
Super User

Hi @nafitycs -Calculating the date difference between the "Order Date" from the Sales table and the "Delivery Date" from the Sales Orders table. I hope there is a relationship exist between two tables (Sales table and the Sales Orders table) with common field.

 

Using calculated column,you can see the report in Table view or data view.

 

DateDifference =
DATEDIFF(
Sales[Order Date],
RELATED('Sales Orders'[Delivery Date]),
DAY
)

 

With measure also works if you are performing on aggregations and you can see value in report view.

 

DateDifferenceMeasure =
VAR OrderDate = SELECTEDVALUE(Sales[Order Date])
VAR DeliveryDate = RELATED('Sales Orders'[Delivery Date])
RETURN
DATEDIFF(OrderDate, DeliveryDate, DAY)

 

 

Hope it works. please check

 

 

Did I answer your question? Mark my post as a solution! This will help others on the forum!
Appreciate your Kudos!!





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





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.