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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Rae2023
Frequent Visitor

How to Filter one table from another tables selection in Dax

Hello,

I have been trying to create a Parent / Child hierarchy with part numbers which I have managed to work out through posts.

This has been created using Dax using Path & Pathlength commands.

I can filter out what I need if I type the part number (see below) in the Dax code and this looks up the "Path" field and (Table 2) gives me my results.

What I would like is to click on (Table 1) and the selected row would be in the Dax code to filter the results in (Table 2).

I can not for the life of me figure out how to get this to work, can anybody help.

 

Screenshot 2024-04-01 at 11.43.31.png

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Rae2023 ,
Thanks for @danextian  reply.

Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:

vheqmsft_1-1712025035786.png

Create a new table with the root Child ID column.

Child ID = VALUES('Table'[Child ID])Child ID = VALUES('Table'[Child ID])

Create two measures

Measure = 
IF(
    SELECTEDVALUE('Table'[Parent ID]) = BLANK(),
    IF(
        SELECTEDVALUE('Table'[Child ID]) = SELECTEDVALUE('Child ID'[Child ID]),
        1,
        0
    ),
    IF(
        SELECTEDVALUE('Table'[Parent ID]) = SELECTEDVALUE('Child ID'[Child ID]) || SELECTEDVALUE('Table'[Child ID]) = SELECTEDVALUE('Child ID'[Child ID]),
        1,
        0
    )
)
Contains = IF([Measure] = 1,".","No Records")

Use measure as the filter on this visual and set show the item is 1

vheqmsft_3-1712025242545.png

Use Child ID [Child ID] as the value of slicer

vheqmsft_4-1712025284889.png

Final output

vheqmsft_5-1712025300893.png

vheqmsft_6-1712025311068.png

 

Best regards,

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

 



 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @Rae2023 ,
Thanks for @danextian  reply.

Here some steps that I want to share, you can check them if they suitable for your requirement.
Here is my test data:

vheqmsft_1-1712025035786.png

Create a new table with the root Child ID column.

Child ID = VALUES('Table'[Child ID])Child ID = VALUES('Table'[Child ID])

Create two measures

Measure = 
IF(
    SELECTEDVALUE('Table'[Parent ID]) = BLANK(),
    IF(
        SELECTEDVALUE('Table'[Child ID]) = SELECTEDVALUE('Child ID'[Child ID]),
        1,
        0
    ),
    IF(
        SELECTEDVALUE('Table'[Parent ID]) = SELECTEDVALUE('Child ID'[Child ID]) || SELECTEDVALUE('Table'[Child ID]) = SELECTEDVALUE('Child ID'[Child ID]),
        1,
        0
    )
)
Contains = IF([Measure] = 1,".","No Records")

Use measure as the filter on this visual and set show the item is 1

vheqmsft_3-1712025242545.png

Use Child ID [Child ID] as the value of slicer

vheqmsft_4-1712025284889.png

Final output

vheqmsft_5-1712025300893.png

vheqmsft_6-1712025311068.png

 

Best regards,

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

 

 



 

Thank you so much,

This has had me scratching my head all weekend.

Once again, thank you.

danextian
Super User
Super User

Hi @Rae2023 ,

 

It seems like a case wildcard lookup. The attached PBIX might help.





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Thank you danextian,

As I'm relatively new to Power BI / DAX, I still can't get this to work.

I've created a .pbix file but can't seem to find the paperclick to attach the example.

Is there a way to select a number in (Table 1) and pass this to the DAX measure, instead of typing in the number in DAX.

The filter in DAX filters correctly and the results are in (Table 2).

Thanks again.

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.

Top Solution Authors