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
shephaliB
Advocate II
Advocate II

One Slicer that filters Multiple Columns

Hi, How do I create one slicer based on multiple columns that can help me filter rows?

 

Here is some sample data:

NameSegmentValueDept view indSegment view ind
JohnX10011
SamY7010
RachelW5001
RamZ1000

 

In the slicer drop down, I need "dept View" and "Segment View". 

When I select "Dept View", This should filter "Dept view ind"=1 and when I select "Segment View", This should filter "Segment view ind"=1

Slicer >
Dept View
Segment View

 

Output for Segment view:

Value = 100+50 = 150

Output for Dept view:

Value = 100+70 = 170

 

Thanks,

Shephali

1 ACCEPTED SOLUTION
Kaly
Resolver II
Resolver II

Hi @shephaliB ,

According to your description, I create a sample:

Table:

Kaly_0-1660205315173.png

Slicer table:

Kaly_1-1660205328983.png

Here's my solution, create a measure:

Measure =
IF (
    ISFILTERED ( Slicer[Slicer] ),
    IF (
        SELECTEDVALUE ( Slicer[Slicer] ) = "Dept view"
            && MAX ( 'Table'[Dept view ind] ) = 1,
        1,
        IF (
            SELECTEDVALUE ( Slicer[Slicer] ) = "Segment view"
                && MAX ( 'Table'[Segment view ind] ) = 1,
            1
        )
    ),
    1
)

Put the measure in the visual filter and select its value to1

Kaly_2-1660205403209.png

Get the result:

Kaly_3-1660205424851.png

Kaly_4-1660205433779.png

Best Regards,

Kaly

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
Kaly
Resolver II
Resolver II

Hi @shephaliB ,

According to your description, I create a sample:

Table:

Kaly_0-1660205315173.png

Slicer table:

Kaly_1-1660205328983.png

Here's my solution, create a measure:

Measure =
IF (
    ISFILTERED ( Slicer[Slicer] ),
    IF (
        SELECTEDVALUE ( Slicer[Slicer] ) = "Dept view"
            && MAX ( 'Table'[Dept view ind] ) = 1,
        1,
        IF (
            SELECTEDVALUE ( Slicer[Slicer] ) = "Segment view"
                && MAX ( 'Table'[Segment view ind] ) = 1,
            1
        )
    ),
    1
)

Put the measure in the visual filter and select its value to1

Kaly_2-1660205403209.png

Get the result:

Kaly_3-1660205424851.png

Kaly_4-1660205433779.png

Best Regards,

Kaly

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

Sudhir44
New Member

Spoiler
Hi @shephaliB 
Below solution will help you getover your problem
Table:A
JohnX10011Dept_View
SamY7010Dept_View
RachelW5001 
RamZ1000 

Table:B
JohnX10011Segment_View
SamY7010 
RachelW5001Segment_View
RamZ1000 

Final Table creation by Union function:
Data_final = UNION(Table_Dept_view,Table_Segment_view)
amitchandak
Super User
Super User

@shephaliB , You can create a table with distinct values what have in these two columns, and then you join both of them with that table, one join will inactive that you can active using userelationship

https://radacad.com/userelationship-or-role-playing-dimension-dealing-with-inactive-relationships-in...

 

The second option is that, keep the table independent and pass value filter using treatas

https://docs.microsoft.com/en-us/dax/treatas-function

Need of an Independent Table in Power BI - Exclude: https://youtu.be/lOEW-YUrAbE

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.