The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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?
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
you have a good and correct statement
= IF('applicant'[col] = 1, "Yes", "No")
please, show text of Error
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.
Every table is linked to applicant via foreign id
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