Forum Discussion

rosh80's avatar
rosh80
Regular Visitor
8 years ago

DAX if statement syntax error

Hi,

 

I am unable to use the IF conditional clause when creating a custom column. 

 

This is the DAX; 

IF(TABLE.COLUMN = TRUE(),"a","b).  This seems to have work in the August release of Power BI, not in the November release. I get the below error.

 

"Couldn't load the data for the visual.

 

OLEDB  or ODBC ERROR. Please try a simpler expression."

 

I am using direct query.

 

Thanks,

 

 

 

 

 

 

6 Replies

  • rosh80's avatar
    rosh80
    Regular Visitor

    It doesnt seem to work for Boolean expressions, it is fine otherwise.

  • v-qiuyu-msft's avatar
    v-qiuyu-msft
    Community Support

    Hi rosh80,

     

    Which Power BI desktop version do you run? 

     

    Based on my test in Power BI desktop version 2.52.4921.682 64-bit (November 2017), get data from SQL database in DirectQuery, create a calculated column like yours, the calculated column values display fine in the table visual. 

     

     

    In your scenario, please run the same desktop version as ours. Make sure the data type of Column field is Bit in database assume you use SQL database. 

     

    Best Regards,
    Qiuyun Yu

     

    • rosh80's avatar
      rosh80
      Regular Visitor

      I am using the November version. The database is Amazon Redshift and the datatype is boolean.

       

      Thanks

      • v-qiuyu-msft's avatar
        v-qiuyu-msft
        Community Support

        Hi rosh80,

         

        Do you run desktop November version 2.52.4921.682? 

         

        When you create this calculated column, is there any error throws out? 

         

        Which visual do you use to show calculated column value? 

         

        Could you share screenshots about the DAX and visual? Do mask sensitive data before uploading. 

         

        Best Regards,
        Qiuyun Yu