Forum Discussion
Measure with multiple conditions and nested loops (earlier)
- Anonymous6 years ago
so....in the end I figured out the solution, in case anyone else searches for this.
Namely I learned that Filter can take multiple criteria, despite the syntax definition implying 1. 2 ways to solve:
1. FIND(TABLE, AND( criteria 1, criteria 2))
2. FIND( TABLE, criteria1 && criteria2 )
Key notes...answer 1, the AND function takes only 2 criteria, so you can't do 3+. Answer 2, you can cascade the && to make multiple criteria past the first 2.
Credit here for where I found the solution:
https://blog.westmonroepartners.com/favorite-quick-easy-dax-multiple-filter-criteria/
In the end I needed to have EARLIER in the inner loop for each condition, to select correctly. Measure works beautifully....
Hi Anonymous ,
Earlier() function is used in calculated column, measure doesn't support it.
You could use ALLEXCEPT() or MAX() function to complete your DAX.
Hi,
thanks for the feedback...the above code is working as today as a measure...
I tried the "ALLEXCEPT", but couldn't get it to work, I'm betting it's a sytanx issue. I'll look at MAX as well to see if that works.
- Anonymous6 years agoNot applicable
so....in the end I figured out the solution, in case anyone else searches for this.
Namely I learned that Filter can take multiple criteria, despite the syntax definition implying 1. 2 ways to solve:
1. FIND(TABLE, AND( criteria 1, criteria 2))
2. FIND( TABLE, criteria1 && criteria2 )
Key notes...answer 1, the AND function takes only 2 criteria, so you can't do 3+. Answer 2, you can cascade the && to make multiple criteria past the first 2.
Credit here for where I found the solution:
https://blog.westmonroepartners.com/favorite-quick-easy-dax-multiple-filter-criteria/
In the end I needed to have EARLIER in the inner loop for each condition, to select correctly. Measure works beautifully....