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
NickProp28
Post Partisan
Post Partisan

Slicer to search multiple column

Dear Community,

 

NickProp28_0-1665653021397.png

I have this sample of raw data and a measure, for example, if I click on 'A', the table will displays 'A' if a record is found in both the seller or buyer columns.

 

Visual Control = 
var tab = {max(Quote[Buyer]),MAX(Quote[Seller])}
var result = COUNTROWS(FILTER(DISTINCT('Name'[Buyer]),
COUNTROWS(FILTER( tab,
[Value] = 'Name'[Buyer]) ) >0 )) +0
return
if ( result>0 , 1,0)

NickProp28_3-1665653474226.png

NickProp28_1-1665653076371.png

 

This measure works perfectly, but when I apply it to another PBIX which have million of raw values, the loading and result will take a very long time.

NickProp28_2-1665653418342.png


However, I am having trouble transforming this measure into a column to see if it speeds up the report loading. Or is there any solution to my issues ?

Any helps would be greatly appreciated!

 

Pbix: https://drive.google.com/file/d/1WhqMBEx71XlTS3Njzbpb0rODfufE7IZ5/view?usp=sharing

1 ACCEPTED SOLUTION

@NickProp28,

 

Try this solution.

 

1. Create calculated column in Quote table:

 

Buyer-Seller = Quote[Buyer] & "-" & Quote[Seller]

 

2. Create calculated table:

 

Name = 
DISTINCT (
    UNION (
        SELECTCOLUMNS (
            Quote,
            "Name", Quote[Buyer],
            "Buyer-Seller", Quote[Buyer-Seller]
        ),
        SELECTCOLUMNS (
            Quote,
            "Name", Quote[Seller],
            "Buyer-Seller", Quote[Buyer-Seller]
        )
    )
)

 

3. Create a many-to-many relationship (Name filters Quote):

 

DataInsights_0-1665756529299.png

 

Compare the performance and let me know. There's another approach using a bridge table and bidirectional filter if performance is still an issue.

 

https://www.sqlbi.com/articles/creating-a-slicer-that-filters-multiple-columns-in-power-bi/ 





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

Proud to be a Super User!




View solution in original post

4 REPLIES 4
DataInsights
Super User
Super User

@NickProp28,

 

Try this measure:

 

Visual Control = 
VAR vNameSelection =
    VALUES ( 'Name'[Name] )
VAR vResult =
    IF (
        MAX ( Quote[Buyer] )
            IN vNameSelection
                || MAX ( Quote[Seller] ) IN vNameSelection,
        1
    )
RETURN
    vResult

 

The Name table contains all Buyer and Seller names, is the source of the Name slicer, and has no relationship with the Quote table. Use the measure [Visual Control] as a visual filter (equals 1).

 

DataInsights_0-1665668416685.png

---

DataInsights_1-1665668437129.png

 





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

Proud to be a Super User!




Dear @DataInsights ,

Thanks for your attention.

NickProp28_0-1665710580546.png

Tried your measure in my PBIX (large dataset), the loading process took a long time. Is that possible to do it in calculated column?

 

@NickProp28,

 

Try this solution.

 

1. Create calculated column in Quote table:

 

Buyer-Seller = Quote[Buyer] & "-" & Quote[Seller]

 

2. Create calculated table:

 

Name = 
DISTINCT (
    UNION (
        SELECTCOLUMNS (
            Quote,
            "Name", Quote[Buyer],
            "Buyer-Seller", Quote[Buyer-Seller]
        ),
        SELECTCOLUMNS (
            Quote,
            "Name", Quote[Seller],
            "Buyer-Seller", Quote[Buyer-Seller]
        )
    )
)

 

3. Create a many-to-many relationship (Name filters Quote):

 

DataInsights_0-1665756529299.png

 

Compare the performance and let me know. There's another approach using a bridge table and bidirectional filter if performance is still an issue.

 

https://www.sqlbi.com/articles/creating-a-slicer-that-filters-multiple-columns-in-power-bi/ 





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

Proud to be a Super User!




Dear @DataInsights ,

Thank you! Calculated column takes less time than the measure, but since the relationship is many to many, I'm not sure if there are any issues will prompt out in the future.

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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