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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

Top Solution Authors