Forum Discussion
Anonymous
6 years agoNot applicable
Filtering a column based on delimited text
I am trying to create a filter that would limit rows based on a delimited string passed into CUSTOMDATA() I've found some samples of how to delimit text, but for the life of me I can't figure out ...
- Anonymous6 years ago
If you have a table with a column [Country], then this filter does filter for the passed in countries in CUSTOMDATA();
// Filter for the Country column =SEARCH( [Country], CUSTOMDATA(), 1, -1) > 0You can also use the CONTAINSSTRING function. It'll be even easier.
Best
D
Anonymous
6 years agoNot applicable
If you have a table with a column [Country], then this filter does filter for the passed in countries in CUSTOMDATA();
// Filter for the Country column
=SEARCH( [Country], CUSTOMDATA(), 1, -1) > 0
You can also use the CONTAINSSTRING function. It'll be even easier.
Best
D
Anonymous
6 years agoNot applicable
Okay the SEARCH function is brilliant. I will be simplifying based on that. I like your solution a lot better as it's easier to understand. However, for anyone looking at this later...
However, I was wrong, I could return the list using in. I just had to change the DAX to account for STRINGS instead of NUMBERS
[CAT] in VAR mymeasure =
SUBSTITUTE ( [Measure 4], "\", "|" )
VAR Mylen =
LEN ( mymeasure )
VAR mytable =
ADDCOLUMNS (
GENERATESERIES ( 1, mylen ),
"mylist", PATHITEM ( mymeasure, [Value] ) )
VAR mylist =
SELECTCOLUMNS ( mytable, "list", [mylist] )
return mylist