Forum Discussion
Filter on comma separated multiselect field
- Anonymous5 years ago
Hi SujoyDasgupta,
The basic filter effect not able to achieve your requirement, I think you need to some more steps and tries.
First, create a new table to extract and expand all types of regions that existed in your table and use it to create a slicer. (notice: it does not have a relationship to the raw table)Expand = VAR _path = SUBSTITUTE ( CONCATENATEX ( VALUES ( 'Table'[Region] ), [Region], "," ), ",", "|" ) RETURN DISTINCT ( SELECTCOLUMNS ( ADDCOLUMNS ( GENERATESERIES ( 1, PATHLENGTH ( _path ), 1 ), "Desc", PATHITEM ( _path, [Value] ) ), "Desc",IF([Desc]<>"", [Desc]," ") ) )Second, write a measure to compare raw table records and slicer selections to return tag and apply on it on table 'visual level filter' to filter records.
Measure = VAR curr = CONCATENATEX ( VALUES ( 'Table'[Region] ), IF ( [Region] <> "", [Region], " " ), "," ) RETURN IF ( COUNTROWS ( FILTER ( ALLSELECTED ( Expand[Desc] ), SEARCH ( [Desc], curr,, -1 ) > 0 ) ) > 0, "Y", "N" )Result:
Regards,
Xiaoxin Sheng
Hi SujoyDasgupta,
The basic filter effect not able to achieve your requirement, I think you need to some more steps and tries.
First, create a new table to extract and expand all types of regions that existed in your table and use it to create a slicer. (notice: it does not have a relationship to the raw table)
Expand =
VAR _path =
SUBSTITUTE (
CONCATENATEX ( VALUES ( 'Table'[Region] ), [Region], "," ),
",",
"|"
)
RETURN
DISTINCT (
SELECTCOLUMNS (
ADDCOLUMNS (
GENERATESERIES ( 1, PATHLENGTH ( _path ), 1 ),
"Desc", PATHITEM ( _path, [Value] )
),
"Desc",IF([Desc]<>"", [Desc]," ")
)
)
Second, write a measure to compare raw table records and slicer selections to return tag and apply on it on table 'visual level filter' to filter records.
Measure =
VAR curr =
CONCATENATEX (
VALUES ( 'Table'[Region] ),
IF ( [Region] <> "", [Region], " " ),
","
)
RETURN
IF (
COUNTROWS (
FILTER ( ALLSELECTED ( Expand[Desc] ), SEARCH ( [Desc], curr,, -1 ) > 0 )
) > 0,
"Y",
"N"
)
Result:
Regards,
Xiaoxin Sheng