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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Writing IF Statement Formula

Hi All,

 

I have a column that contains (formated as time) minutes. I am trying to writie an If statement like this: If (column that contains minutes) is less than 30 minutes, then "YES" otherwise "NO". I get this error after trying to write the formula "DAX comparison operations do not support comparing values of type DATE with values of type TEXT.

Any ideas on how best to write this formula??

 

Thanks

1 ACCEPTED SOLUTION

Below should help to convert hour to minutes and compare in IF statement

 

IF( HOUR(Table1[Column1]) * 60 + MINUTE (Table1[Column1]) <=30,"Yes", "No")

View solution in original post

5 REPLIES 5
SethuPower
Frequent Visitor

Please provide a sample of how your minutes column data is represented and how you are representing 30 mins in the formula

Anonymous
Not applicable

The minutes column looks like this example 0:14,1:05, etc.

This is how I tried writing the formula: If(Column name<=("0:30"), "Yes", "No")).

 

Hope this explains it clearly.

 

Thanks

Below should help to convert hour to minutes and compare in IF statement

 

IF( HOUR(Table1[Column1]) * 60 + MINUTE (Table1[Column1]) <=30,"Yes", "No")

Anonymous
Not applicable

Hi,

 

I just used your suggested formula and it worked like magic.

 

Many thanks for the quick solution.

 

Regards

 

 

Pls mark this as a solution Smiley Happy 

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.