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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Spotto
Helper IV
Helper IV

Compare two hours Columns - error

Hello everyone, I have a column in the datetime table that extracts the time and put a column with a fixed time (16:00). I need to compare the two columns and return 1 or 0, but the formula I made is not working.

 

Spotto_0-1677261488451.png

Thanks for the help 🙂

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

Seems to work ok.

 

 

Table 2 = ADDCOLUMNS(DATATABLE("Column1",DATETIME,{{"24 Feb 2023 14:56:17"}}),"Compare",if(TIMEVALUE([Column1])>TIMEVALUE("16:00:00"),1,0))

Keep in mind that when no date value is specified a date of 12/30/1899 is assumed which is of course less that 24 Feb 2023.

 

View solution in original post

1 REPLY 1
lbendlin
Super User
Super User

Seems to work ok.

 

 

Table 2 = ADDCOLUMNS(DATATABLE("Column1",DATETIME,{{"24 Feb 2023 14:56:17"}}),"Compare",if(TIMEVALUE([Column1])>TIMEVALUE("16:00:00"),1,0))

Keep in mind that when no date value is specified a date of 12/30/1899 is assumed which is of course less that 24 Feb 2023.

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.