cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
AClerk New Contributor
New Contributor

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 Member
Member

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

View solution in original post

2 REPLIES 2
ElenaN Member
Member

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

View solution in original post

AClerk New Contributor
New Contributor

Re: Compare Dates

Smiley Frustrated

uh!
Silly me...

 

Cheers!

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 312 members 3,216 guests
Please welcome our newest community members: