Forum Discussion

vrv's avatar
vrv
Icon for Helper II rankHelper II
3 years ago
Solved

simple measure

hi all,

i need a simple measure DAX expression that checks a bit field and gets a value of "GOOD" when the field tested is 1 AND "BAD" if the tested fields is 0.

All my common sense attempts failed as I can't get the syntax ... and neither a fast answer to a simple question.

Thanks

  • Hello vrv ,
     If you need to have the result in the below format, you need to create a Calculated column. You are not able to enter the column name because you are trying to create a measure. And a column cannot be used in a measure.

    Result = SWITCH(Table_Name[column_name], 1, "GOOD", 0, "BAD")

    OR

    Result = IF(Table_Name[column_name] = 1, "GOOD", "BAD")

     

     

     

5 Replies

  • Hello vrv 

     

    Please review the below:

    Result = SWITCH(TestedField, 1, "GOOD", 0, "BAD")

    OR

    Result = IF(TestedField = 1, "GOOD", "BAD")

    Note: Replace "TestedField" with the name of the bit field in your data model.

    Also, please upvote if you find it helpful.

    • vrv's avatar
      vrv
      Icon for Helper II rankHelper II

      hello saurabhkudale96,

      what is the proper syntax for "TestedField"?

      is it: Table.FieldName, [Table]FieldName, [Table]"FieldName", [Table].[FieldName] ........ ???

       

      Thanks,

      vrv

  • Hi anybody, any idea?

    my question is how do I enter the column name?

    what is the correct format?

     

    Apparently I can't drag and drop the column in there, so somethign is wrong ...

     

    Thank you,

    vrv

     

    I

    • saurabhkudale96's avatar
      saurabhkudale96
      Frequent Visitor

      Hello vrv ,
       If you need to have the result in the below format, you need to create a Calculated column. You are not able to enter the column name because you are trying to create a measure. And a column cannot be used in a measure.

      Result = SWITCH(Table_Name[column_name], 1, "GOOD", 0, "BAD")

      OR

      Result = IF(Table_Name[column_name] = 1, "GOOD", "BAD")