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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
PriyankaJhaTheA
Helper III
Helper III

Urgent!! Can two slicers from the same column give me data in the table?

Hello Power Bi Community, 

 

I have a special situation here, I have two slicers as you can see below, and the table has data that contains data that includes values from both slicers.

 

What i need is if i select any values from either slicers, the table should filter to contain only those values:

 
So, this is what's happening now:

PriyankaJhaTheA_0-1716621934245.png

 

Exected output for the above selection is:

 

Column1

-----------

Retailer

Market1

 

 

Link to Sample dashboard:  https://goanalitica-my.sharepoint.com/:u:/p/priyanka_jha/ETbne82MZRtJipboWHnubJ4BmH4y2mdOYlp3-dKgvFt... 

 

PS: Also, I cannot have one slicer, as my client wants two separate slicers. 

 

Please take a look and let me know if you need anything else.
Look forward to your replies.

@MFelix , @amitchandak , @Greg_Deckler , @tamerj1 , @Jihwan_Kim , @Joe_Barry , @Ashish_Mathur, 


 Idrissshatila
1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @PriyankaJhaTheA ,

 

If you want to filter a visual by using an OR or "either" approach, the slicer columns must be from a table that doesnt have an active relationshipo to the table being filtered then use a measure  to filter it.  Here's a sample measure.

Filter = 
VAR __T =
    VALUES ( 'Table'[Column1] )
VAR __T3 =
    VALUES ( 'Table (3)'[Column1] ) 
--both columns from the above must have the same name
VAR __UNION =
    UNION ( __T, __T3 )
RETURN
    CALCULATE (
        COUNTROWS ( 'Table (2)' ),
        KEEPFILTERS ( 'Table (2)'[Column1] IN __UNION )
    )

 

danextian_0-1716646732455.png

 










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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

3 REPLIES 3
danextian
Super User
Super User

Hi @PriyankaJhaTheA ,

 

If you want to filter a visual by using an OR or "either" approach, the slicer columns must be from a table that doesnt have an active relationshipo to the table being filtered then use a measure  to filter it.  Here's a sample measure.

Filter = 
VAR __T =
    VALUES ( 'Table'[Column1] )
VAR __T3 =
    VALUES ( 'Table (3)'[Column1] ) 
--both columns from the above must have the same name
VAR __UNION =
    UNION ( __T, __T3 )
RETURN
    CALCULATE (
        COUNTROWS ( 'Table (2)' ),
        KEEPFILTERS ( 'Table (2)'[Column1] IN __UNION )
    )

 

danextian_0-1716646732455.png

 










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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hello @danextian , 

Thanks for providing this solution,
But I have a lot of data in these two filters and now I have added another filter similar to these two.

And I'm using the below code, but it is taking a lot of visual resources to filter the data and in sum cases the query doesn't even executes fully. 
Can you help me with a better approach?

Stub Selection =
VAR __T =
VALUES ( 'Data Dict - Stubs - Category'[Mapping for Stubs Filter])
VAR __T3 =
VALUES ( 'Data Dict - Stubs - Shopper'[Mapping for Stubs Filter] )
VAR __T2 =
VALUES ( 'Data Dict - Stubs - Retailer'[Mapping for Stubs Filter] )
--both columns from the above must have the same name
VAR __UNION =
UNION ( __T, __T3 , __T2)
RETURN
CALCULATE (
COUNTROWS ( 'Data Dict - Stubs' ),
KEEPFILTERS ( 'Data Dict - Stubs'[Mapping for Stubs Filter] IN __UNION )

I tested the same measure with data of over 18M rows and categories of over 600K rows and the performance was fine so there could be other factors that's causing the performance issue.

danextian_0-1718250607356.png

 










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


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors