Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Drake1002
Frequent Visitor

Filter table having a column with delimited values

Hi,

I hope someone can help me with this.

 

I have a comma delimited column . I want to be able to see only those rows which contain the value selected in the slicer .

 

E.g. if some one selects apple then rows containing apple will be diplayed

IMG_20240414_114830.jpg

2 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

Try to put the below measure into the visual filter pane.

 

 

Jihwan_Kim_0-1713089702320.png

 

condition measure: = 
VAR _countslicer =
    COUNTROWS ( VALUES ( Slicer[Slicer] ) )
VAR _slicerselect =
    VALUES ( Slicer[Slicer] )
VAR _t =
    GENERATESERIES ( 1, _countslicer, 1 )
VAR _changefruittable =
    ADDCOLUMNS ( Fruits, "@path", SUBSTITUTE ( Fruits[Fruits], ", ", "|" ) )
VAR _pathlength =
    ADDCOLUMNS ( _changefruittable, "@length", PATHLENGTH ( [@path] ) )
VAR _generate =
    GENERATE ( _pathlength, GENERATESERIES ( 1, [@length], 1 ) )
VAR _fruitinfo =
    ADDCOLUMNS ( _generate, "@item", PATHITEM ( [@path], [Value], TEXT ) )
RETURN
    INT (
        COUNTROWS ( FILTER ( _fruitinfo, [@item] IN _slicerselect ) ) <= _countslicer && 
        COUNTROWS ( FILTER ( _fruitinfo, [@item] IN _slicerselect ) ) <> 0
    )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

View solution in original post

PhilipTreacy
Super User
Super User

Hi @Drake1002 

 

Download PBIX file with example shown below

 

Create a table with the fruit names which will be used for the slicer.  This is not connected to the Fruits table.

 

Create this measure in the Fruits table

 

 

Selected Fruit = IF(CONTAINSSTRING(MAX('Fruits'[Fruits]), SELECTEDVALUE(SlicerTable[Fruit])), 1)

 

 

In the table visual for the Fruits table, add that measure as a filter and set it to Show items when the value is 1

 

fruit-slicer.png

 

fruit-pear.png

fruit-orange.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

4 REPLIES 4
Drake1002
Frequent Visitor

Thanks Jihwan_Kim. This works when the selected value is at the first index for the string otherwise it displays nothing.

PhilipTreacy
Super User
Super User

Hi @Drake1002 

 

Download PBIX file with example shown below

 

Create a table with the fruit names which will be used for the slicer.  This is not connected to the Fruits table.

 

Create this measure in the Fruits table

 

 

Selected Fruit = IF(CONTAINSSTRING(MAX('Fruits'[Fruits]), SELECTEDVALUE(SlicerTable[Fruit])), 1)

 

 

In the table visual for the Fruits table, add that measure as a filter and set it to Show items when the value is 1

 

fruit-slicer.png

 

fruit-pear.png

fruit-orange.png

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Thanks PhilipTreacy. This works well if for single selection what if I want multiple selection .Also the table displays total at the end but does it not the actual count. How to find the actual count and display it on the card.

For example, if apple and pear is selected then the rows with apple and pear should be displayed.

Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your semantic model looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

Try to put the below measure into the visual filter pane.

 

 

Jihwan_Kim_0-1713089702320.png

 

condition measure: = 
VAR _countslicer =
    COUNTROWS ( VALUES ( Slicer[Slicer] ) )
VAR _slicerselect =
    VALUES ( Slicer[Slicer] )
VAR _t =
    GENERATESERIES ( 1, _countslicer, 1 )
VAR _changefruittable =
    ADDCOLUMNS ( Fruits, "@path", SUBSTITUTE ( Fruits[Fruits], ", ", "|" ) )
VAR _pathlength =
    ADDCOLUMNS ( _changefruittable, "@length", PATHLENGTH ( [@path] ) )
VAR _generate =
    GENERATE ( _pathlength, GENERATESERIES ( 1, [@length], 1 ) )
VAR _fruitinfo =
    ADDCOLUMNS ( _generate, "@item", PATHITEM ( [@path], [Value], TEXT ) )
RETURN
    INT (
        COUNTROWS ( FILTER ( _fruitinfo, [@item] IN _slicerselect ) ) <= _countslicer && 
        COUNTROWS ( FILTER ( _fruitinfo, [@item] IN _slicerselect ) ) <> 0
    )

 

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Visit my LinkedIn page by clicking here.


Schedule a meeting with me to discuss further by clicking here.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.