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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Merleau
Helper II
Helper II

Cross filtering: How to cross filter a list column using a value from a different table

Hello

 

In my report I need to cross filter two tables which are not linked in my data model.

 

Table 1

Id   NameCode
Id1Id1_name        A
Id2Id2_Name     B
Id3Id3_Name  AL
Id4Id4_Name  BC
Id5Id5_Name  L

 

 

Table2

key

RegionCode listName
t1       reg1       L,      Name1
t2reg2A,L,Name2
t3reg3B,A,Name3
t4reg4BL,AL,A,      Name4
t5reg5BC,Name5
t6reg6A,Name6
t7reg7A,B,BL,Name7

 

 

What I need, is the following.

If a user click on any row in Table1, then the rows in Table 2 that contain the code  selected in Table 1 are all highlighted or filter out.

 

e.g

In Table1, I select row 2 with code = B, then in Table2, rows 3 and 7 are all selected.

 

Again these two tables are not linked in my model.

Any help is greatly appreciated.

Thank you.

 

 

4 REPLIES 4
Anonymous
Not applicable

Hi @Merleau ,

 

Please try this

vxiaocliumsft_0-1733198794729.png

Measure = IF( SEARCH(TRIM( SELECTEDVALUE(Table1[Code])), SELECTEDVALUE('Table2'[Code list]), 1, 0)<>0, SELECTEDVALUE('Table2'[Code list]))
vxiaocliumsft_1-1733198813481.png
vxiaocliumsft_2-1733198821924.png

 

Best Regards,

Wearsky

Hello @Anonymous 

Thank you for your prompt response. The measure works but only consistently for codes with double letters. For single-letter codes, it sometimes returns records that include double-letter codes where one of the letters matches the single-letter code.

For example, selecting "L" (Line 5 in Table1) also returns "BL, AL, A" (Line 4 in Table2).

Could you advise on how this can be fixed?

 

My real data have a long list of codes most are single-letter and an even longer list of "Code list" that include different codes combination.

 

Thank you,

 

Sahir_Maharaj
Super User
Super User

Hello @Merleau,

 

Can you please try creating a Bridge Table - Then create relationships and enable Cross-Filtering.

BridgeTable = 
DISTINCT(
    UNION(
        SELECTCOLUMNS('Table1', "Code", 'Table1'[Code]),
        SELECTCOLUMNS('Table2', "Code", PATHITEM('Table2'[Code list], 1, TEXT)),
        SELECTCOLUMNS('Table2', "Code", PATHITEM('Table2'[Code list], 2, TEXT)),
        SELECTCOLUMNS('Table2', "Code", PATHITEM('Table2'[Code list], 3, TEXT))
    )
)

Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hello @Sahir_Maharaj 

Thank you so much for your response.

Could pls provide further details?

I am not able to create that bridge table from your response.

Many thanks, again.

 

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.