Forum Discussion
Date difference between two different tables
- 6 years ago
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.
Due Date Shipped Date Days Early/Late
Jan 10 2020 Jan 15 2020 5
Jan 12 2020 Jan 09 2020 -3
Anonymous
Please check the solution in file, if that can help https://www.dropbox.com/s/y47ah38sr157l7t/Oder_delivery.pbix?dl=0
- Anonymous6 years agoNot applicable
Hi Amit -
Thanks so much for that file...it was great...something I can learn from.
I tried "way 2" and it seems to work, although I am getting results for dates that have not even happened yet. See image. Note the first two dates.
- Anonymous6 years agoNot applicable
Also, these results are strange. Note that sometimes they show correctly that the shipment was 3 days early. But for the same dates sometimes it says -9. It could be because there are multiple lines attached to one order...and maybe the lines shipped at different times and it is picking up the latest ship date? Checking into that now.
- amitchandak6 years agoSuper User
Anonymous
I am assuming, you have created both new columns as calculation. Can you share the formula
- Anonymous6 years agoNot applicable
.Yes, I created 2 calculated columns in the Orders table
Way 2 Delivery Date = maxx(filter('Flu Shipped','Flu Shipped'[Order]=Orders[Order]),'Flu Shipped'[Date Shipped])Way 2 date Diff = DATEDIFF('Orders'[Due Date],'Orders'[Way 2 Delivery Date],DAY)I checked the lines and that was not the issue. I am still getting what seems to be random strange results.