Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hello,
I have a column which has values of = "0", "1" and Empty.
How do I create a custom column which gives me the following information.
IF
0 = Fail
1 = Pass
Empty = Pass
I've been trying the below -
=IF [Attend Pass] = 1 then "Pass" else "Fail"
TIA
Solved! Go to Solution.
Hi @Anonymous ,
M code is completely case-sensitive, so using 'IF' instead of 'if' will cause the calculation to fail. Similarly, referencing '1' instead of ' "1" ' if the value is in a text field will also fail.
Also, your condition is picking out the 1 = pass criteria first. It's simpler to pick out the 0 = Fail first, then just apply pass to 1 and null as per your requirement.
Try these calculations to see what works for you:
// [Attend Pass] = numeric
if [Attend Pass] = 0 then "Fail" else "Pass"
// [Attend Pass] = text
if [Attend Pass] = "0" then "Fail" else "Pass"
Pete
Proud to be a Datanaut!
Hi @Anonymous ,
M code is completely case-sensitive, so using 'IF' instead of 'if' will cause the calculation to fail. Similarly, referencing '1' instead of ' "1" ' if the value is in a text field will also fail.
Also, your condition is picking out the 1 = pass criteria first. It's simpler to pick out the 0 = Fail first, then just apply pass to 1 and null as per your requirement.
Try these calculations to see what works for you:
// [Attend Pass] = numeric
if [Attend Pass] = 0 then "Fail" else "Pass"
// [Attend Pass] = text
if [Attend Pass] = "0" then "Fail" else "Pass"
Pete
Proud to be a Datanaut!
Check out the July 2025 Power BI update to learn about new features.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
User | Count |
---|---|
10 | |
7 | |
7 | |
6 | |
6 |