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
- SujoyDasgupta5 years agoFrequent Visitor
Hi Anonymous ,
I will try to implent your above solution and update you.
Thank you for your reply.
- Anonymous5 years agoNot applicable
HI SujoyDasgupta,
Ok, I hope these can be worked on your side.🙂
If they not help, you can feel free to post here with some dummy data or pbix file, then we can test to coding formula and build sample file share.
Regards,
Xiaoxin Sheng