Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi all,
So, I am trying to calculate the difference between two different date columns in two separate tables.
Essentially, I have 2 tables that look like this (sorry for the poor screenshot lol)
So, I am trying to calculate the difference between these dates in terms of months. But I cannot figure out how to actually calculate it using DATEDIFF. I can't have a relationship between the two dates because they are completely different. I would think to create a new column within the shipped date table and use DATEDIFF(Shipped Date[Shipped Date], Action Date[List], MONTH) but it refuses to accept it, saying it cannot find Action Date[List] or that there needs to be a relationship between them.
I would appreciate any help!
Solved! Go to Solution.
Hi @Anonymous ,
In your scenario, it is not supported to create a relationship between two tables because they don't have a same column to create relationship, at least you need to have a id column or other.
If you want to calculate the DATEDIFF row by row, you can create an index column for two tables like below:
Then we can create a relationship between these two index column, after that we can create a calculated column using the following DAX query:
Column = CALCULATE(DATEDIFF(MIN(Table1[Shipped Date]),MIN(Table2[Action Date]),MONTH))
The result will like below:
Best Regards,
Teige
Hi @Anonymous ,
In your scenario, it is not supported to create a relationship between two tables because they don't have a same column to create relationship, at least you need to have a id column or other.
If you want to calculate the DATEDIFF row by row, you can create an index column for two tables like below:
Then we can create a relationship between these two index column, after that we can create a calculated column using the following DAX query:
Column = CALCULATE(DATEDIFF(MIN(Table1[Shipped Date]),MIN(Table2[Action Date]),MONTH))
The result will like below:
Best Regards,
Teige
That makes more sense. I have a string for each customer, am I not able to relate that between the two?
in your shipped date table, what date from the other table would you be looking to subtract? Seems like there should be a few more columns to each of these tables.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.