Forum Discussion
tarocha
Helper II
5 years agoFilter with three conditions
Hello can you help me? I have a column calculated to filter students who have not taken either class or another. I would like to include one more condition to search for those who did not take 3 ...
- 5 years ago
I was using the wrong filter for the third condition, instead of using || was using &&.
Now working.This is the code
Column = if('Table'[DONE]="NOT"&&'Table'[CLASS]="CLASS 1" && MAXX(FILTER('Table','Table'[NAME]=EARLIER('Table'[NAME])&&('Table'[CLASS]="CLASS 2"||'Table'[CLASS]="CLASS 3")),'Table'[DONE])="NOT","Not for class1&2&3", if('Table'[DONE]="NOT"&&'Table'[CLASS]="CLASS 1" && MAXX(FILTER('Table','Table'[NAME]=EARLIER('Table'[NAME])&&'Table'[CLASS]="CLASS 2"),'Table'[DONE])="NOT","Not for class1&2", if('Table'[DONE]="NOT"&&'Table'[CLASS]="CLASS 2" && MAXX(FILTER('Table','Table'[NAME]=EARLIER('Table'[NAME])&&'Table'[CLASS]="CLASS 3"),'Table'[DONE])="NOT","Not for class2&3", "")))
FrankAT
Community Champion
5 years agoHi tarocha
you can do it like this:
Measure =
VAR _Table =
FILTER(
'Table',
'Table'[DONE] = "NOT" &&
'Table'[CLASS] = "CLASS 1" ||
'Table'[CLASS] = "CLASS 2" ||
'Table'[CLASS] = "CLASS 3"
)
VAR _Count = COUNTX(_Table,'Table'[NAME])
RETURN
IF(_Count = 3 , "Not in Class 1, 2 , 3", BLANK())
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)
- tarocha5 years ago
Helper II
Hi, FrankAT
I need it to be a calculated column for you to use as a slicer.
I was able to make two conditions with the dax code below, but I'm having trouble including one more condition for another class.Column = if('Table'[DONE]="NOT"&&'Table'[CLASS]="CLASS 1" && MAXX(FILTER('Table','Table'[NAME]=EARLIER('Table'[NAME])&&'Table'[CLASS]="CLASS 2"),'Table'[DONE])="NOT","Not for class1&2",if('Table'[DONE]="NOT"&&'Table'[CLASS]="CLASS 2" && MAXX(FILTER('Table','Table'[NAME]=EARLIER('Table'[NAME])&&'Table'[CLASS]="CLASS 3"),'Table'[DONE])="NOT","Not for class2&3",""))