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

Score big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount

Reply

two slicers with same values to show values on one chart

Hello commnity, 

 

I am working on a report that has two slicers to filter a scatter plot. SlicerA's single selected value is a direct comparison to many values selected from SlicerB.

 

The issue is I cannot have SlicerA's value and SlicerB's values to both show on the scatter plot without manually selecting the same value from SlicerA on SlicerB. 

 

  • SlicerA and SlicerB both have same values and no relationship, but SlicerA only allows single selection whereas SlicerB can have Multiple selections.

 

 I tried so many ways to resolve this, but they dont work. One of them is that I tested below measure, but it does not show slicerA's value "Ma" on the chart if I dont select the same value on slicerB. I disconnect the interection between slicerB and the chart, it does not work either. 

 

 

measure = 
VAR tgtSel =
    SELECTEDVALUE ( A[Target] ) --to store selected value on SlicerA
VAR peerSel = 
    VALUES(B[CompareGroup]) --to store many values selected on SlicerB
VAR tab = 
    --to have a filter that contains both slicerA and slicerB 's values
    FILTER ('table', 
            'table'[GroupNames] IN  peerSel ||
            'table'[GroupNames] = tgtSel  
            )
RETURN
    CALCULATE ( SUM ( 'table'[amount] ), tab )

 

 

 

I dont want to turn off the relationship between slicers and the table because it's not good for future use of the data model. Is there a way to have both slicers' values to show on the scatter plot simultaneously without selecting on SlicerB for the one that was selected on SlicerA?

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Yes, like this.

Measure = 
VAR _TgtSel = 
    { CALCULATE(
        SELECTEDVALUE ( A[Target] ),
        REMOVEFILTERS ( B ) )
    }
VAR _PeerSel =
    VALUES ( B[CompareGroup] )
VAR _List =
    UNION ( _TgtSel, _PeerSel )
RETURN
    CALCULATE (
        [Total Amount],
        KEEPFILTERS ( TREATAS ( _List, 'Table'[GroupNames] ) ),
        REMOVEFILTERS ( B )
    )

View solution in original post

6 REPLIES 6
jdbuchanan71
Super User
Super User

If you don't use REMOVEFILTERS, with the connection from B > the table, it doesn't let the values selected in A show up.

jdbuchanan71
Super User
Super User

Yes, like this.

Measure = 
VAR _TgtSel = 
    { CALCULATE(
        SELECTEDVALUE ( A[Target] ),
        REMOVEFILTERS ( B ) )
    }
VAR _PeerSel =
    VALUES ( B[CompareGroup] )
VAR _List =
    UNION ( _TgtSel, _PeerSel )
RETURN
    CALCULATE (
        [Total Amount],
        KEEPFILTERS ( TREATAS ( _List, 'Table'[GroupNames] ) ),
        REMOVEFILTERS ( B )
    )

Thank you!! You are **bleep** good at this. It took me so many days and not know removefilters()

This solution perfectly fits what I need. Could you please explain why removefilters() has to be added for this to work? I just want to understand it, so I can apply this to other issue. 

jdbuchanan71
Super User
Super User

@learninPBI5Hard 

Not sure this is what you are looking for but I think it might be.
I have the two disconnected tables with the GroupNames.

jdbuchanan71_2-1691899757684.png

And the measure to read the selections and apply them to the data:

1st, just a measure to total the amount.

 

Total Amount = SUM ( 'Table'[Amount] )

 

The, the measure to read the selections and do the final calculation.

 

Measure = 
VAR _TgtSel =
    { SELECTEDVALUE ( A[Target] ) }
VAR _PeerSel =
    VALUES ( B[CompareGroup] )
VAR _List =
    UNION ( _TgtSel, _PeerSel )
RETURN
    CALCULATE (
        [Total Amount],
        KEEPFILTERS ( TREATAS ( _List, 'Table'[GroupNames] ) )
    )

 

The {} around the SELECTEDVALUE in _TgtSel converts it to a table so it can be used in the UNION.

jdbuchanan71_3-1691899791230.png

I have attached my sample file for you to look at.

 

 

Is there a way to do this when there is relationship between b and the table? 

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.