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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
arosenberg
Regular Visitor

Multiple Column Filter

Hello

I am attempting to create a filter based on the below table. The goal would be create a filter with all the distinct values in the column Manager1 and use that as a filter for all four columns. 

 

For Example: 

The filter for the below would contain the values ManagerA, ManagerB, ManagerC, ManagerD, ManagerE because they are the distinct values in the Manager1 column.

So if you filtered on ManagerC, you could see Employee A, Employee B, Employee D, Employee F, regardless of what column they are in.

 Manager1Manager2Manager3Manager4
Employee AManagerAManagerBManagerCManagerD
Employee BManagerCManagerD  
Employee CManagerD   
Employee DManagerBManagerCManagerD 
Employee EManagerEManagerF  
Employee FManagerBManagerCManagerD 

 

Let me know if you have any questions. Thank you in advance for the help.

Andrew

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @arosenberg 

Thank you for your swift response. Based on the data structure you’ve provided, I have two proposals:
 

Before we begin with either option, we need to prepare the slicer. Therefore, I have created the following calculation table to generate columns for all managers, which will serve as the slicer.

Table 2 = 
 VAR n1=SELECTCOLUMNS('Table',"1",'Table'[Manager1])
 VAR n2=SELECTCOLUMNS('Table',"1",'Table'[Manager2])
 VAR n3=SELECTCOLUMNS('Table',"1",'Table'[Manager3])
 VAR n4=SELECTCOLUMNS('Table',"1",'Table'[Manager4])
RETURN DISTINCT(UNION(n1,n2,n3,n4))


 

vlinyulumsft_1-1731559225782.png

 

Of course, this step's calculation table can also be processed using Power Query. Below are the detailed M language instructions:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs0tyMmvTE1VcFTSUTI0AhLOOZmpeSVgfkBRfkppMoRtAsQWQOybmJeYnlrkiGA6IZjOCKaLUqwOHuOdkIx3otx4kCJjE+zGO0KNtsBhkI6SAhijGAhSYWqGMNAZzb1GeqZA0hxMYphE0DQ3JNNA2owpMg05qkByhiSZBpIyt0CY5oJmGlrQ4YoODHNdgUKWBghzXdH8jGauK4Lpht2hIGFDQ+yB6ESiQ2MB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [em = _t, #"em #" = _t, Client = _t, Product = _t, Hours = _t, #"Sum Hours" = _t, Manager1 = _t, Manager2 = _t, Manager3 = _t, Manager4 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"em", type text}, {"em #", Int64.Type}, {"Client", type text}, {"Product", type text}, {"Hours", type number}, {"Sum Hours", type number}, {"Manager1", type text}, {"Manager2", type text}, {"Manager3", type text}, {"Manager4", type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"em #", "Client", "Product", "Hours", "Sum Hours"}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Removed Columns", {"em"}, "Attribute", "Value"),
    #"Removed Columns1" = Table.RemoveColumns(#"Unpivoted Columns",{"em", "Attribute"}),
    #"Removed Duplicates" = Table.Distinct(#"Removed Columns1")
in
    #"Removed Duplicates"

vlinyulumsft_2-1731559257699.png

1.For the first proposal:

Firstly, you will need to select these fields in Power Query and then merge them.

vlinyulumsft_3-1731559257700.png

Secondly, please use the following measures and apply them to the filters of the visual objects:

MEASURE =
IF (
    ISFILTERED ( 'Table 2'[1] ),
    IF ( CONTAINSSTRING ( MAX ( 'Table'[Merged] ), MAX ( 'Table 2'[1] ) ), 1, 0 ),
    1
)

vlinyulumsft_4-1731559313408.png

 

Here are the final results:

vlinyulumsft_5-1731559313411.png

2.For the second proposal:

You can directly use the following measures and apply them to the filters of the visual objects:

Measure2 =
VAR cc1 =
    MAX ( 'Table 2'[1] )
RETURN
    IF (
        ISFILTERED ( 'Table 2'[1] ),
        IF (
            CONTAINS ( 'Table', 'Table'[Manager1], cc1 )
                || CONTAINS ( 'Table', 'Table'[Manager2], cc1 )
                || CONTAINS ( 'Table', 'Table'[Manager3], cc1 )
                || CONTAINS ( 'Table', 'Table'[Manager4], cc1 ),
            1,
            0
        ),
        1
    )

vlinyulumsft_6-1731559345038.png

 

Here are the final results:

vlinyulumsft_7-1731559345040.png

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

6 REPLIES 6
arosenberg
Regular Visitor

Just to complicate it a bit more, what if there are multiple other columns? Not just manager and employee. Similar to the below. Will these solutions still work? I tried a few and haven't been able to figure out.

emem #ClientProductHoursSum HoursManager1Manager2Manager3Manager4
Employee A12Client AProduct A48ManagerAManagerBManagerCManagerD
Employee A12Client BProduct B48ManagerAManagerBManagerCManagerD
Employee B34Client BProduct A88ManagerCManagerD  
Employee C56Client CProduct B2.57.5ManagerD   
Employee C56Client FProduct D3.57.5ManagerD   
Employee C56Client AProduct C1.57.5ManagerD   
Employee D78Client DProduct C88ManagerBManagerCManagerD 
Employee E90Client EProduct D88ManagerEManagerF  
Employee F11Client FProduct B88ManagerBManagerCManagerD 

Is there a way to just see records from employees who report to ManagerC?

Thanks everyone for the responses

Anonymous
Not applicable

Hi, @arosenberg 

Thank you for your swift response. Based on the data structure you’ve provided, I have two proposals:
 

Before we begin with either option, we need to prepare the slicer. Therefore, I have created the following calculation table to generate columns for all managers, which will serve as the slicer.

Table 2 = 
 VAR n1=SELECTCOLUMNS('Table',"1",'Table'[Manager1])
 VAR n2=SELECTCOLUMNS('Table',"1",'Table'[Manager2])
 VAR n3=SELECTCOLUMNS('Table',"1",'Table'[Manager3])
 VAR n4=SELECTCOLUMNS('Table',"1",'Table'[Manager4])
RETURN DISTINCT(UNION(n1,n2,n3,n4))


 

vlinyulumsft_1-1731559225782.png

 

Of course, this step's calculation table can also be processed using Power Query. Below are the detailed M language instructions:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs0tyMmvTE1VcFTSUTI0AhLOOZmpeSVgfkBRfkppMoRtAsQWQOybmJeYnlrkiGA6IZjOCKaLUqwOHuOdkIx3otx4kCJjE+zGO0KNtsBhkI6SAhijGAhSYWqGMNAZzb1GeqZA0hxMYphE0DQ3JNNA2owpMg05qkByhiSZBpIyt0CY5oJmGlrQ4YoODHNdgUKWBghzXdH8jGauK4Lpht2hIGFDQ+yB6ESiQ2MB", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [em = _t, #"em #" = _t, Client = _t, Product = _t, Hours = _t, #"Sum Hours" = _t, Manager1 = _t, Manager2 = _t, Manager3 = _t, Manager4 = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"em", type text}, {"em #", Int64.Type}, {"Client", type text}, {"Product", type text}, {"Hours", type number}, {"Sum Hours", type number}, {"Manager1", type text}, {"Manager2", type text}, {"Manager3", type text}, {"Manager4", type text}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"em #", "Client", "Product", "Hours", "Sum Hours"}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Removed Columns", {"em"}, "Attribute", "Value"),
    #"Removed Columns1" = Table.RemoveColumns(#"Unpivoted Columns",{"em", "Attribute"}),
    #"Removed Duplicates" = Table.Distinct(#"Removed Columns1")
in
    #"Removed Duplicates"

vlinyulumsft_2-1731559257699.png

1.For the first proposal:

Firstly, you will need to select these fields in Power Query and then merge them.

vlinyulumsft_3-1731559257700.png

Secondly, please use the following measures and apply them to the filters of the visual objects:

MEASURE =
IF (
    ISFILTERED ( 'Table 2'[1] ),
    IF ( CONTAINSSTRING ( MAX ( 'Table'[Merged] ), MAX ( 'Table 2'[1] ) ), 1, 0 ),
    1
)

vlinyulumsft_4-1731559313408.png

 

Here are the final results:

vlinyulumsft_5-1731559313411.png

2.For the second proposal:

You can directly use the following measures and apply them to the filters of the visual objects:

Measure2 =
VAR cc1 =
    MAX ( 'Table 2'[1] )
RETURN
    IF (
        ISFILTERED ( 'Table 2'[1] ),
        IF (
            CONTAINS ( 'Table', 'Table'[Manager1], cc1 )
                || CONTAINS ( 'Table', 'Table'[Manager2], cc1 )
                || CONTAINS ( 'Table', 'Table'[Manager3], cc1 )
                || CONTAINS ( 'Table', 'Table'[Manager4], cc1 ),
            1,
            0
        ),
        1
    )

vlinyulumsft_6-1731559345038.png

 

Here are the final results:

vlinyulumsft_7-1731559345040.png

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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


 

Hello, Thank you so much for this solution.

This worked well. One question for you, is there a way to make it so you can filter on multiple managers at a time?

Anonymous
Not applicable

Thanks for the reply from Laxmanjatoth and johnt75  please allow me to provide another insight:

Hi, @arosenberg 

My approach is almost identical to that of Laxmanjatoth . I’ve created the following example to aid your understanding:

 

1.Firstly, let’s assume your original data looks like this:

vlinyulumsft_0-1731480163989.png

2.Secondly, in Power Query, select all columns except the first one, as shown in the image below:

vlinyulumsft_1-1731480163990.png

3.Then, remove any unnecessary columns:

vlinyulumsft_2-1731480212783.png

4.Next, create the visualisation objects and slicers in the Desktop application:

vlinyulumsft_3-1731480212788.png

You may need to note that there are null values in the slicer options, so we should add an additional filter:

 

vlinyulumsft_4-1731480227584.png

5.Here's my final result, which I hope meets your requirements.

vlinyulumsft_5-1731480227587.png

 

Can you share sample data and sample output in tabular format if I am misunderstanding? Or a sample pbix after removing sensitive data. We can better understand the problem and help you.

When uploading a file, please be careful to delete sensitive information.

 

For questions about uploading data, you can try the following links:

How to provide sample data in the Power BI Forum - Microsoft Fabric Community

Solved: How to upload PBI in Community - Microsoft Fabric Community

 

When uploading a file, please be careful to delete sensitive information.

 

Please find the attached pbix relevant to the case.

 

Best Regards,

Leroy Lu

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

 

Laxmanjatoth
Resolver I
Resolver I

hey hi ,see teh below sb , 

 

 

reate a Table for All Distinct Managers:

You want to create a distinct list of managers from all four manager columns (Manager1, Manager2, Manager3, Manager4). We can use DAX to unpivot these columns into a new table, which will give us a list of all managers.
Here's how you can do this in Power Query:

In Power Query (Transform Data), select your table.
Select the four manager columns (Manager1, Manager2, Manager3, Manager4).
Right-click and choose Unpivot Columns. This will create two new columns:
Attribute (containing Manager1, Manager2, etc.),
Manager (containing all distinct managers from the four columns).
The result will be a new table with all managers in a single column:

Employee Manager
Employee A ManagerA
Employee A ManagerB
Employee A ManagerC
Employee A ManagerD
Employee B ManagerC
Employee B ManagerD
Employee C ManagerD
Employee D ManagerB
Employee D ManagerC
Employee D ManagerD
Employee E ManagerE
Employee E ManagerF
Employee F ManagerB
Employee F ManagerC
Employee F ManagerD
This approach ensures that the manager names are now in a single column, which can be used to filter employees.


Create a Slicer:

Now that you have a column (Manager) with all distinct manager names, you can add this column to a slicer in your report.
In your slicer, select the Manager column from the unpivoted table. This slicer will allow you to select a specific manager.

johnt75
Super User
Super User

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors