Ayush Sinha
Ayush Sinha

Reputation: 41

How do I take the difference of two datetime columns in power bi?

I have two different datetime columns in two different tables T1 and T2. I have defined a one-to-one 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".

The dates are in the following format: 10-12-2019 12:00:00. How do I take the difference?

Upvotes: 0

Views: 1032

Answers (1)

Peter
Peter

Reputation: 12295

Add a Calculated Column to T1:

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

Upvotes: 1

Related Questions