Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Anonymous
Not applicable

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
ElenaN
Resolver V
Resolver V

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
Resolver V
Resolver V

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

Anonymous
Not applicable

Smiley Frustrated

uh!
Silly me...

 

Cheers!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.