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

Help! Want to filter a table if the slicer selection is in either one of 2 columns.

Hey,

So for data structure, I have two tables with similar info, but they are tied together by posn number.  The end goal is that the slicer will filter the table if the selection is in either of the two columns in the table. 

I tried to make a dimension table using 'summarize' to create the slicer, pulling all the personal trades from one table, and all the positional trades from another table. 

dim Trades =
DISTINCT(
    UNION(SUMMARIZE('All Pers', 'All Pers'[Trade Name]),
        SUMMARIZE('POSN Trade', 'POSN Trade'[Trade Name])    
    )
)


It doesn't seem to be working. When I use the slicer, it's only pulling up lines that have the selected Trade name, but it's not pulling up the people that have the pers trade, in posns with a diff trade.

Any ideas?

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Cheywork91 
Make 'dim Trades' a disconnetced table (delete the relationships between the dim table and the other two tables). In other words, the three tables model will be left without any relationship.

Place the following measure in the filter pane of the visual, select "is not blank" and apply the filter. I would expect the slicer from  'dim Trades' will filter the visual based on OR condition rather than AND.

FilterMeasure =
VAR SelectedTrades =
    VALUES ( 'dim Trades'[Trade] )
VAR Pers =
    COUNTROWS ( FILTER ( 'All Pers', 'All Pers'[Trade Name] IN SelectedTrades ) )
VAR Posn =
    COUNTROWS (
        FILTER ( 'POSN Trade', 'POSN Trade'[Trade Name] IN SelectedTrades )
    )
RETURN
    Pers + Posn

 

View solution in original post

3 REPLIES 3
tamerj1
Super User
Super User

Hi @Cheywork91 
Make 'dim Trades' a disconnetced table (delete the relationships between the dim table and the other two tables). In other words, the three tables model will be left without any relationship.

Place the following measure in the filter pane of the visual, select "is not blank" and apply the filter. I would expect the slicer from  'dim Trades' will filter the visual based on OR condition rather than AND.

FilterMeasure =
VAR SelectedTrades =
    VALUES ( 'dim Trades'[Trade] )
VAR Pers =
    COUNTROWS ( FILTER ( 'All Pers', 'All Pers'[Trade Name] IN SelectedTrades ) )
VAR Posn =
    COUNTROWS (
        FILTER ( 'POSN Trade', 'POSN Trade'[Trade Name] IN SelectedTrades )
    )
RETURN
    Pers + Posn

 

amitchandak
Super User
Super User

@Cheywork91 , You joined the dimension back to both tables ?

Both table will be filtered by common dim

 

refer, if need

https://amitchandak.medium.com/power-bi-when-i-asked-you-to-create-common-tables-a-quick-dax-solutio...

Yes, but the problem is that it's not finding all the people with the selected trade, when their posn trade is something different. 

When Y on the slicer is selected, I want it to show me the lines where :
Pers is R trade, but their posn is Y trade.
Pers is Y trade, posn Y trade.
Pers is Y trade, posn is B trade. 

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.