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
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
v-xiaocliu-msft
Community Support
Community Support

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 @v-xiaocliu-msft 

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
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.