cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MikeMCFRS
Helper III
Helper III

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

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")

View solution in original post

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
PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!

secondImage

The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.