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
omelei86
Frequent Visitor

Filter in multiple columns

Hi 

 

I am relatively new to PowerBI. Hope you can help. 

 

Table Opportunities

 

Opportunity ID

Sales Team (coming from Opp owner)

Sales Team (coming from Revenue responsible)

XjxjxjxhxA

Team A

Team A

XjxjxjxhxB

Team B

Team B

XjxjxjxhxC

Team A

Team B

XjxjxjxhxD

Team B

Team A

 

Now I'd like to apply a Filter visual on Sales team. However, it should filter on both columns

 

Let's say we filter on Sales Team = Team A, the expected result should be:

 

Opportunity ID

Sales Team (coming from Opp owner)

Sales Team (coming from Revenue responsible)

XjxjxjxhxA

Team A

Team A

XjxjxjxhxC

Team A

Team B

XjxjxjxhxD

Team B

Team A

 

Any idea? Thanks in advance..

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @omelei86 
Please refer to sample file with the solution https://www.dropbox.com/t/YXMM3TcOQdZ9yboj

First create the filter table 

 

 

Filter Table = 
SELECTCOLUMNS ( 
    DISTINCT ( 
        UNION ( 
            VALUES ( Opportunities[Sales Team (Opp owner)] ), 
            VALUES ( Opportunities[Sales Team (Revenue responsible)] ) 
        )
    ),
    "Sales Team", [Sales Team (Opp owner)]
)

 

 

3.png

Then Create new measure

 

 

Filter = 
COUNTROWS ( 
    FILTER ( 
        Opportunities, 
        Opportunities[Sales Team (Opp owner)] IN ALLSELECTED ( 'Filter Table'[Sales Team] ) 
            || Opportunities[Sales Team (Revenue responsible)] IN ALLSELECTED  ( 'Filter Table'[Sales Team] ) 
    ) 
)

 

 

Place it in the filter pane of the table visual then select "Is not blank" and apply.

1.png2.png

 

View solution in original post

4 REPLIES 4
tamerj1
Super User
Super User

Hi @omelei86 
Please refer to sample file with the solution https://www.dropbox.com/t/YXMM3TcOQdZ9yboj

First create the filter table 

 

 

Filter Table = 
SELECTCOLUMNS ( 
    DISTINCT ( 
        UNION ( 
            VALUES ( Opportunities[Sales Team (Opp owner)] ), 
            VALUES ( Opportunities[Sales Team (Revenue responsible)] ) 
        )
    ),
    "Sales Team", [Sales Team (Opp owner)]
)

 

 

3.png

Then Create new measure

 

 

Filter = 
COUNTROWS ( 
    FILTER ( 
        Opportunities, 
        Opportunities[Sales Team (Opp owner)] IN ALLSELECTED ( 'Filter Table'[Sales Team] ) 
            || Opportunities[Sales Team (Revenue responsible)] IN ALLSELECTED  ( 'Filter Table'[Sales Team] ) 
    ) 
)

 

 

Place it in the filter pane of the table visual then select "Is not blank" and apply.

1.png2.png

 

ALLUREAN
Solution Sage
Solution Sage

Hi, @omelei86 

Please check attached file




Did I answer your question? Mark my post as a solution!


https://allure-analytics.com/
https://www.youtube.com/channel/UCndD_QZVNB_JWYLEmP6KrpA
https://www.linkedin.com/company/77757292/

Proud to be a Super User!




Thanks @ALLUREAN 

This is a step in the right direction. However, the values in my Opportunity table are not unique. I might have duplicate CombinedDescription values...

 

Is there any way to fix this?

omelei86_0-1653903228252.png

 

tamerj1
Super User
Super User

Hi @omelei86 

you can create a separate filter table which you can use a a slicer.  Code for such table can be something like 

DISTINCT ( VALUES ( TableName[Column1] ), VALUES ( TableName[Column2] ) )

Then you may try creating a filter measure such as

COUNTROWS ( FILTER ( TableName, TableName[Column1] IN ALLSELECTED ( FilterTable[ColumnName] ) || TableName[Column2] IN ALLSELECTED  ( FilterTable[ColumnName] ) ) )

place it in the filter pane and select "Is not blank" and apply the filter. 

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.