Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

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

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

     

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

5 Replies

  • SethuPower's avatar
    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's avatar
      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

      • SethuPower's avatar
        SethuPower
        Frequent Visitor

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

         

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