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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
RyotNomad
Frequent Visitor

Use an if statement to replace values returned by a table

I have a table with a column that contains only 1 or 0. However when I put this into my pie chart my legend shows 1 and 0. I cannot change the values in the table adn I'd prefer not to create a new table. I'm new to DAX so I tried this:

 

Measure = IF('applicant'[col] = 1, "Yes", "No")

 

But that doesn't work. Could someone guide me on how to fix this?

7 REPLIES 7
az38
Community Champion
Community Champion

Hi @RyotNomad 

try to create a Column with the same statement, not a measure 


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

Hi. Could you show me how the DAX would look? I've clicked create new column and then used col = IF(Applicant[col], "Yes","No) but I get an error on the Yes saying it's invalid

az38
Community Champion
Community Champion

@RyotNomad 

you have a good and correct statement

 = IF('applicant'[col] = 1, "Yes", "No")

please, show text of Error


do not hesitate to give a kudo to useful posts and mark solutions as solution
LinkedIn

The syntax for "Yes" is incorrect. (DAX(IF( (Applicant[X6_13]) = 1. "Yes", "No"))).
 
 
My actual column name is X6_13. I don't know why it's putting a full stop after the 1. It's clearly a comma in my DAX statement
 
My exact Code:
Column= IF( (Applicant[X6_13]) = 1, "Yes", "No")
Anonymous
Not applicable

Hi @RyotNomad,

What type of value existed in your 'x6_13' field? Please check it to use the correct value in your if statement: (you can't directly use equal operator to compare with text and number value)

Number version:

Column =
IF ( Applicant[X6_13] = 1, "Yes", "No" )

Text version:

Column =
IF ( Applicant[X6_13] = "1", "Yes", "No" )

Notice: please also check your calculated column data type if it does not recognize as a text value.

If above not helps, can you please share more detail information about your scenario? 

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Unfortunately neither of those worked. 

 

I'm not sure what you mean by the calcualted column data type being recognized as a text value.

 

I've included a screenshot of the data.

 

https://imgur.com/a/c4VFVN4

 

Every table is linked to applicant via foreign id

Anonymous
Not applicable

HI @RyotNomad,

Table fields can't direct use in measure formula, it can calculate and compare with aggregate values do you need to use aggregate functions to pack your table fields. (e.g. max, min, sum...)

Power BI DAX Aggregate Functions 

Measure=
IF ( max(Applicant[X6_13]) = 1, "Yes", "No" )

In addition, I'd like to suggest you take a look at the following blog about the difference between the calculated column and measure to help you know more about the difference and usage of these calculated fields:

Calculated Columns and Measures in DAX 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.