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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
vrv
Helper II
Helper II

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

1 ACCEPTED SOLUTION

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

saurabhkudale96_0-1682999126922.png 

saurabhkudale96_1-1682999231356.png

 

 

View solution in original post

5 REPLIES 5
vrv
Helper II
Helper II

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

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

saurabhkudale96_0-1682999126922.png 

saurabhkudale96_1-1682999231356.png

 

 

saurabhkudale96
Frequent Visitor

It is the "Bit Field". Please enter your Column name there.

saurabhkudale96
Frequent Visitor

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.

hello saurabhkudale96,

what is the proper syntax for "TestedField"?

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

 

Thanks,

vrv

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.