Forum Discussion
Anonymous
6 years agoNot applicable
If Statement Returns Incorrect Result in New Column
I am attempting to add a new column which looks through the specification column and returns the details in the rating column. I have tried this two different ways but neither seems to work as all t...
- 6 years ago
You will want to reverse your checks. Check for *** first, then for ** , then for * .
Anonymous
6 years agoNot applicable
Thank you very much for that. Can you please explain why this worked?
Is it because in the way I had it set up originally the function would find the first * in the string return the defined result for that and then stop iterating through the rest of the if statements?
lbendlin
6 years agoSuper User
yep, you got it. The SWITCH() statement in DAX does the same. As soon as it has a match it exits.
Actually there is a bit more to your question than you might think. Here's a very interesting link
https://www.sqlbi.com/articles/understanding-eager-vs-strict-evaluation-in-dax/