Forum Discussion
Filter value from column with multiple values
- Anonymous5 years ago
If you know in advance about all such cases, you could handle it as follows...
Flavour = VAR CheckOV = SEARCH("OV",FlavourData[Groupcode],1,BLANK()) VAR Check2 = SEARCH("2",FlavourData[Groupcode],1,BLANK()) VAR CheckX = SEARCH("X",FlavourData[Groupcode],1,BLANK()) VAR CheckOH = SEARCH("OH",FlavourData[Groupcode],1,BLANK()) VAR CheckH = SEARCH("H",FlavourData[Groupcode],1,BLANK()) VAR Result = SWITCH( TRUE(), NOT(ISBLANK(CheckOV)),"Contains OV", NOT(ISBLANK(Check2)),"Contains 2", NOT(ISBLANK(CheckX)),"Contains X", NOT(ISBLANK(CheckH)) && ISBLANK(CheckOH),"Contains H", NOT(ISBLANK(CheckOH)),"Contains OH", "Wrong Value" ) RETURN ResultIf you don't know about all such cases, then you have to figure out some other way.
Thanks for the reply, this would seem to do the trick! Is it also possible to extend the search parameter? In this example I only used "OV", but in reality I have a few more "flavours" that have the same problem. Is it possible to do these results in 1 column? Thanks!
You can add more OR conditions using || to the IF condition
If you don't want to add so much DAX code, then alternatively you can tell the users to use the advanced filter option of the visuals.
But the options will be limited to 1 or 2 values at a time.
The best option is to automatically generate a table for filtering in PowerQuery, create a relationship and use that PowerQuery generated table for filtering.... Refer to the image below...