Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
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.
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
Solved! Go to Solution.
@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.
but try this
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.
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
unfortunately it doesn't work
@Anonymous
@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
no error appears when writing the formula but when applying it this appears.
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
The same thing happened, it shows no error in the syntax but at the moment of applying it does not give the desired result.
but try this
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.
User | Count |
---|---|
139 | |
113 | |
103 | |
73 | |
63 |
User | Count |
---|---|
136 | |
125 | |
107 | |
70 | |
61 |