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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
EaglesTony
Post Prodigy
Post Prodigy

I need help on setting up a relationship between 2 tables

I have 2 tables:

 

Table1:

NAME

ABC

ABC

DEF

DEF

DEF

HIJ

 

Table2

ITEM         ITEMPREFIX

WAA-123   WAA

WAA-456   WAA

STE-1       STE

 

I have 2 slicers, the first uses Table1, the second uses Table2 and I want to filter Table2 based on the selected item in Table1.

 

Example:

If I select ABC from the first slicer, I want to show WAA-123 and WAA-456. (anything that has the ItemPrefix of WAA)

 

If I select DEF from the first slicer, I want to show WAA-123 and WAA-456.  (anything that has the ItemPrefix of WAA)

 

If I select HIJ from the first slicer, I want to show STE-1.  (anything that has the ItemPrefix of STE)

 

Any ideas, without duplicating data in Table2 ?

 

1 ACCEPTED SOLUTION
PaulDBrown
Community Champion
Community Champion

This seems to work. Create a measure to use as a filter in the filter pane for table 2 along the lines of:

 

 

Filter Table 2 =
IF (
    ISFILTERED ( 'Table 1'[NAME] ),
    SWITCH (
        SELECTEDVALUE ( 'Table 1'[NAME] ),
        "HIJ", COUNTROWS ( INTERSECT ( VALUES ( 'Table 2'[ITEMPREFIX] ), { "STE" } ) ),
        COUNTROWS ( INTERSECT ( VALUES ( 'Table 2'[ITEMPREFIX] ), { "WAA" } ) )
    ),
    1
)

 

 

 

Add the measure to the filter pane and set the output value to = 1

 

Filter pane.pngFTI.gif





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






View solution in original post

1 REPLY 1
PaulDBrown
Community Champion
Community Champion

This seems to work. Create a measure to use as a filter in the filter pane for table 2 along the lines of:

 

 

Filter Table 2 =
IF (
    ISFILTERED ( 'Table 1'[NAME] ),
    SWITCH (
        SELECTEDVALUE ( 'Table 1'[NAME] ),
        "HIJ", COUNTROWS ( INTERSECT ( VALUES ( 'Table 2'[ITEMPREFIX] ), { "STE" } ) ),
        COUNTROWS ( INTERSECT ( VALUES ( 'Table 2'[ITEMPREFIX] ), { "WAA" } ) )
    ),
    1
)

 

 

 

Add the measure to the filter pane and set the output value to = 1

 

Filter pane.pngFTI.gif





Did I answer your question? Mark my post as a solution!
In doing so, you are also helping me. Thank you!

Proud to be a Super User!
Paul on Linkedin.






Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors