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
Raj12
Helper III
Helper III

How to take the difference of two different table date columns in power bi?

How do I take the difference of two different table date columns that are connected with ID's  as Many to MAny relationship in power bi?

I have two different datetime columns in two different tables T1 and T2. I have defined a many-to-many relationship between the two tables using a common column named 'id'. I want to make a new column that stores the difference of the datetime columns, for which I used the following command:

date3= DATEDIFF('T1'[date1], 'T2'[date2],DAY)

This command is not working and the message says, "A single value of date2 cannot be determined in the table T2".

. How do I take the difference?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Raj12 ,

 

As a workaround, you could create a measure instead.

days = DATEDIFF(MAX('T1'[Date]),MAX('T2'[Date]),DAY)

vstephenmsft_3-1653893233335.png

 

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Raj12 ,

 

As a workaround, you could create a measure instead.

days = DATEDIFF(MAX('T1'[Date]),MAX('T2'[Date]),DAY)

vstephenmsft_3-1653893233335.png

 

 

 

 

Best Regards,

Stephen Tao

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.