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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

How to show BI slicer with unique value and do table visualization filter?

I have single SharePoint list, at backend Audience colunm have multiselect lookup.
When I get list in Bi, the Audince column value show in ; seperated formate in table
Ex: audience1;  audience2; and so on
When I assign this column to slicer, Slicer look like:
audience1;  audience2;

audience1

audience1;  audience3;

Etc.
So how i pass unique value to slicer? and my table visual performed filter based on column

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

Hi @Anonymous 

You may try my way to build the slicer column by dax.

1.png

Build a new table by dax.

Slicer Audiance = 
VAR myvalues =
    ADDCOLUMNS (
        'Table',
        "AudincePaths", SUBSTITUTE ( 'Table'[Audince], ";  ", "|" )
    )
RETURN
    VAR myvalues2 =
        ADDCOLUMNS (
            myvalues,
            "AudincePaths2", SUBSTITUTE ( [AudincePaths], ";", "|" )
        )
    RETURN
        VAR _T =
            SELECTCOLUMNS (
                GENERATE (
                    myvalues2,
                    ADDCOLUMNS (
                        GENERATESERIES ( 1, PATHLENGTH ( [AudincePaths2] ) ),
                        "MyAudince", PATHITEM ( [AudincePaths2], [Value], TEXT )
                    )
                ),
                "Audince", [MyAudince]
            )
        RETURN
            SUMMARIZE ( FILTER ( _T, [Audince] <> BLANK () ), [Audince] )

Slicer Table:

2.png

Then we build a measure to filter the table by slicer.

Measure:

Measure = IF(CONTAINSSTRING(MAX('Table'[Audince]),SELECTEDVALUE('Slicer Audiance'[Audince])),1,0)

Build a table visual by Table[Audiance], then drag measure into this visual and set it show items if value =1.

Result is as below.

When I select "audience1"

1.png

When I select "audience2"

2.png

You can download the pbix file from this link:  File

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

View solution in original post

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @Anonymous 

You may try my way to build the slicer column by dax.

1.png

Build a new table by dax.

Slicer Audiance = 
VAR myvalues =
    ADDCOLUMNS (
        'Table',
        "AudincePaths", SUBSTITUTE ( 'Table'[Audince], ";  ", "|" )
    )
RETURN
    VAR myvalues2 =
        ADDCOLUMNS (
            myvalues,
            "AudincePaths2", SUBSTITUTE ( [AudincePaths], ";", "|" )
        )
    RETURN
        VAR _T =
            SELECTCOLUMNS (
                GENERATE (
                    myvalues2,
                    ADDCOLUMNS (
                        GENERATESERIES ( 1, PATHLENGTH ( [AudincePaths2] ) ),
                        "MyAudince", PATHITEM ( [AudincePaths2], [Value], TEXT )
                    )
                ),
                "Audince", [MyAudince]
            )
        RETURN
            SUMMARIZE ( FILTER ( _T, [Audince] <> BLANK () ), [Audince] )

Slicer Table:

2.png

Then we build a measure to filter the table by slicer.

Measure:

Measure = IF(CONTAINSSTRING(MAX('Table'[Audince]),SELECTEDVALUE('Slicer Audiance'[Audince])),1,0)

Build a table visual by Table[Audiance], then drag measure into this visual and set it show items if value =1.

Result is as below.

When I select "audience1"

1.png

When I select "audience2"

2.png

You can download the pbix file from this link:  File

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

amitchandak
Super User
Super User

@Anonymous , does column contains values like

audience1; audience2;

audience1

audience1; audience3;

 

If so you might have split data on ;

https://www.tutorialgateway.org/how-to-split-columns-in-power-bi/

Anonymous
Not applicable

Thank you @amitchandak. Can you suggest other method than split?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.