cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Sil_2022
New Member

Using a slicer category to filter a column with text separated values

Hi everyone,

 

I have a category list (let's call it fruit). I have a table with the column fruit, but the column has multiple categories separated by commas. I would like to use the slicer feature where I can select one category, and the table will filter by the specific category regardless if the row has multiple categories. See example below:

 

Fruit category table

1. Apple 

2. Orange

3. Pineapple

4. Grape

 

The report table has a column that has multiple fruit categories

1. Apple

2. Apple, Orange

3. Grape, Pineapple, Orange

4. Grape, Orange

5. Apple, Grape

 

If I select Apple in the slicer, I would like the table to filter as follows:

1. Apple

2. Apple, Grape

3, Apple, Orange.

 

In other words, look for the selected category in the slicer and filter the table based on the selected slicer value. 

 

Any help is much appreciated! Thank you much. 

2. Apple, Orange

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

HI @Sil_2022,

I'd like to suggest you extract and expand these values to single fruit, then you can use it as source of slicer.

New Table =
VAR _path =
    SUBSTITUTE (
        CONCATENATEX ( VALUES ( 'Table'[Column] ), [Column], "," ),
        ",",
        "|"
    )
VAR _length =
    PATHLENGTH ( _path )
VAR _pathtable =
    ADDCOLUMNS (
        GENERATESERIES ( 1, _length, 1 ),
        "Column", PATHITEM ( _path, [Value] )
    )
RETURN
    pathtable

After these steps, you can write a measure formula(get the current selection and use search function to filter table records) to use on visual level filter to filter table records.

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

HI @Sil_2022,

I'd like to suggest you extract and expand these values to single fruit, then you can use it as source of slicer.

New Table =
VAR _path =
    SUBSTITUTE (
        CONCATENATEX ( VALUES ( 'Table'[Column] ), [Column], "," ),
        ",",
        "|"
    )
VAR _length =
    PATHLENGTH ( _path )
VAR _pathtable =
    ADDCOLUMNS (
        GENERATESERIES ( 1, _length, 1 ),
        "Column", PATHITEM ( _path, [Value] )
    )
RETURN
    pathtable

After these steps, you can write a measure formula(get the current selection and use search function to filter table records) to use on visual level filter to filter table records.

Regards,
Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
amitchandak
Super User
Super User

@Sil_2022 , refer if this can help

Power BI- Text Part slicer to filter/search text - https://youtu.be/MKKWeOqFG4c

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors
Top Kudoed Authors