cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AClerk Member
Member

Compare Dates

Hi,

Why is this giving correct results?

Column INT = IF(Table1[Column1].[Date] > Table1[Column2].[Date], 0, 1)


And this is not?

Column DIFF = IF(Table1[Column1].[Date] > Table1[Column2].[Date], DATEDIFF(Table1[Column3].[Date], Table1[Column1].[Date],DAY), DATEDIFF(Table1[Column3].[Date], Table1[Column2].[Date],DAY))
 
 

2019-02-21 08_28_52-papercut - Remote Desktop Connection.png

1 ACCEPTED SOLUTION

Accepted Solutions
ElenaN Regular Visitor
Regular Visitor

Re: Compare Dates

Hello,

 

It does give the correct result in both cases.

 

Why it might seem it is not correct is because as you wrote your formula for Column DIFF in your sample data you compare the same dates 1/1/2020 with 02/20/2019, on both rows, so you get the same -315 result

 

Regards,

ElenaN

2 REPLIES 2
ElenaN Regular Visitor
Regular Visitor

Re: Compare Dates

Hello,

 

It does give the correct result in both cases.

 

Why it might seem it is not correct is because as you wrote your formula for Column DIFF in your sample data you compare the same dates 1/1/2020 with 02/20/2019, on both rows, so you get the same -315 result

 

Regards,

ElenaN

AClerk Member
Member

Re: Compare Dates

Smiley Frustrated

uh!
Silly me...

 

Cheers!