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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.