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
Anonymous
Not applicable

How do I make this if condition in dax?

I have a doubt, I have 2 columns which say the reason for rejection of a product, and I want to add a third column where I indicate the reason for rejection.
Screenshot (93).png

if it is 1 it means that the product was rejected for that reason, if it is 0 it means that it was not rejected for that reason.

the question is, I want to make a conditional "if" where I say

if NCN = 1 then "NCN"
or
if SLA = 1 then "SLA"
or
if NCN & SLA = 1 then "SLA & NCN"

If you do not meet any of the 3 conditions then "No Rej"


How would the condition be in Dax?

 This would be an example of how I want to show the information

Screenshot (94).png

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@Anonymous 
The same thing happened, it shows no error in the syntax but at the moment of applying it does not give the desired result.
Screenshot (98).png   Screenshot (99).png

but try this
Screenshot (100).pngScreenshot (101).png

and it came out, remember that the "if" are loops and their order affects in the last example that you sent me it gave result, given that the first "if" and the second were fulfilled and as the first 2 had already been fulfilled then omitted the third, and it was only investing it by first looking for the conditional where the first 2 are 1 and if that conditional is not fulfilled then go to the next 2, Thank you very much for giving me your help and time a greeting.

View solution in original post

6 REPLIES 6
Anonymous
Not applicable

Hi @Anonymous,

 

You could use OR with the if like:

 

if(NCN = 1, "NCN",
if(SLA = 1, "SLA",
if(NCN & SLA = 1, "SLA & NCN","No Rej")))

If you do not meet any of the 3 conditions then "No Rej"

 

Let me know if it worked, if so mark as solution.

 

BR,

DR

Anonymous
Not applicable

unfortunately it doesn't work 
@Anonymous 

Screenshot (95).png

Anonymous
Not applicable

@Anonymousthat's not dax, that's M.

 

In M goes like this:

if NCN = 1 then "NCN"
else
if SLA = 1 then "SLA"
else
if NCN & SLA = 1 then "SLA & NCN" else "No Rej"

 

Try that one and let me know, if it worked mark as solution.

 

BR,

DR

Anonymous
Not applicable

@Anonymous 
no error appears when writing the formula but when applying it this appears.
Screenshot (96).png

Anonymous
Not applicable

I just saw you're concatenating the two columns in the third if, wht'a the purpose for that, they're numbers so you can't concatenate.

So what you mean is if both are 1 right?
If so then you have to use and goes like:

 

if NCN = 1 then "NCN"
else
if SLA = 1 then "SLA"
else
if NCN=1 and SLA = 1 then "SLA & NCN" else "No Rej"

Hope it worked now, if so mark as solution.

 

BR,

DR

Anonymous
Not applicable

@Anonymous 
The same thing happened, it shows no error in the syntax but at the moment of applying it does not give the desired result.
Screenshot (98).png   Screenshot (99).png

but try this
Screenshot (100).pngScreenshot (101).png

and it came out, remember that the "if" are loops and their order affects in the last example that you sent me it gave result, given that the first "if" and the second were fulfilled and as the first 2 had already been fulfilled then omitted the third, and it was only investing it by first looking for the conditional where the first 2 are 1 and if that conditional is not fulfilled then go to the next 2, Thank you very much for giving me your help and time a greeting.

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.

Top Solution Authors
Top Kudoed Authors