Forum Discussion
Dynamic filtering between two tables
Hello, I have a question about dynamic filtering between two tables that do not have a direct relationship.
The requirement is: when using a hierarchical slicer (default slicer with levels), the “User” slicer should also automatically filter accordingly. For example, when selecting the “Technology Division,” the User slicer should automatically show only members belonging to that level and its child levels.
I’ve tried some approaches such as creating a bridge table and applying DAX filters to the User slicer, but the results are still not as expected.
I would appreciate any guidance. Thank you.
Link sample file: https://drive.google.com/file/d/1UytBF5HUNV0ix86qclRsSRvWnyeeqK7k/view?usp=drive_link
You can create a measure like
Employee is visible = VAR CurrentCode = SELECTEDVALUE( User[Mã Bộ Phận (Ngẫu nhiên các Level)] ) VAR Result = SWITCH( SELECTEDVALUE( User[Cấp độ mã] ), "Level 2", IF( CurrentCode IN VALUES( Org[Level 2 Code] ), 1 ), "Level 3", IF( CurrentCode IN VALUES( Org[Level 3 Code] ), 1 ), "Level 4", IF( CurrentCode IN VALUES( Org[Level 4 Code] ), 1 ) ) RETURN Resultand use this as a filter on the user slicer, set to show only when the value is 1.
7 Replies
- ryan_mayuSuper User
i can't open the link, could you pls share the pbix file by another way?
- AlexAuto2026New Member
Please re-open. it's still working. But you can use new link as bellow: https://limewire.com/d/AG8kE#NQX5ngSALO
- johnt75Super User
You can create a measure like
Employee is visible = VAR CurrentCode = SELECTEDVALUE( User[Mã Bộ Phận (Ngẫu nhiên các Level)] ) VAR Result = SWITCH( SELECTEDVALUE( User[Cấp độ mã] ), "Level 2", IF( CurrentCode IN VALUES( Org[Level 2 Code] ), 1 ), "Level 3", IF( CurrentCode IN VALUES( Org[Level 3 Code] ), 1 ), "Level 4", IF( CurrentCode IN VALUES( Org[Level 4 Code] ), 1 ) ) RETURN Resultand use this as a filter on the user slicer, set to show only when the value is 1.
- AlexAuto2026New Member
Thank you! This is exactly what I wanted.
- SharmilaBriscaResolver I
Hi AlexAuto2026,
Slicers only interact through model relationships — DAX alone cannot “force” one slicer to filter another reliably.
If you want slicer-to-slicer interaction → you MUST use relationships.
Solution:
Update the Power Query M script in the Advanced Editor by replacing the specified steps with the new M code.
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tVdLb9tGEP4rC51aIIskPvTOh16VSEkk46RIfWApVlxIXArU0oCPRQ45+GKjKIoeglg2AiNFjbqPS0QEOVDw/+A/6SzFxwpVwUKOLxKX8+18s7Pz4suXDSXw5zY9QZKsNB41Nr+yTZGVxj/RCWqTZOmj9XkanzsbOZYHKjwdrl9RNPeSPwFktddnlRAPWi1YWd7dLZomH9G30ZMnB18hK0zjKzRLPuZIQGHJtBpHj3Yb0fOAk6AeoR4aBzb18n2m1G+a8Kx4BFEvWYJYI2n8A0VyuvrdqVBYk2Ex3JhYqUFPc4gmY/XpQ9Ovz9L4F4Lgb7UkwumBXGp/RnLd9kVqfefJDwpyHasHD0uen1tN4z8QQCvi4dd7E8OBlgyxEEgh9ixAn8Lq7jaN39CJYIDM41OfeCT5lSInjd9H3P9cNYM910Wkqtgw62wB+08dDx2n8bt8m8QtscIIPMuSS38nApuHXMcLbtpbAAqYMvoAgp/Xht+9+HkKZyf/EcCLu/IWOLU83JN6FKWrK8ojGQ09fiCWfCi9D9RDych0BIhlFSSXwGv8vLMnp+KtX/lokfzloB7EACC85EIkVQwtPy+cdH2eXBDUCdiMUDfHAAB3+nX0mh1OXUZKzVrPgqfyLYLIT1ef4PD8Yq+cCoVNy9j2Da9+4PEJgi3x66jwvGVgWdvPDJVMCLNnu6RY7bZhZQYO4QB3TOxcCAJsDpSHYhy64fdB6NvUcR9L44VAOmwa+5GavGJMudNo0TmGhkDczFZ5eZEcRo5tRoIitEGKJaW2qehecknRAqjyfR3h+ljIC8sOCJZUHmbKxiwZfdHP77iw00tWDppBaJAvi9hUNazID2qOFZ1k9XAMSVPlBPAazdp7300sVJf1WXLBM3m1DCrevq5mV1CKUC+NPyAKE0HBDxBs9moT7j78W+7pQLxk1f0cdvY1UzCDr2rMsHjBcLzkpmw5rS5vYj3IdsSCqn/BawgvZUuE9CwUv4PfwvmKgrt6bRDej9Xy4PyfBEZLerEvo/A+m1SuI8TubgX2rn64Xd7UbLRgWfvPcYDBSqvOBCX5GzbSCaxeFxutf/V26Cyra4p8UO+XKKw2uRWy7UxdOkaWW04dIMBy8+GpW2FA2Q7u1t7cHYhsHt7XVRWBMfIqAP7VDav4uzofqc2TBXN9JI19Unm9hc1vaiP88/B3LWRG83kQsscddzYfu4upaMaz2plCgaCNf4ZY4wkOg1k1tim8lGmRvdXZ4S0ePjNESZ5t/IPktGhyAMH9+ia3N7kOIXEzR1P4ex8JnF3tvgfuBxOyYMRZCJz9QbuxGaCOgZYKzeWSf3BxtUV1G7T/x0wlZK3Sz3eOpOzuhZo5ik4gBZLfysowkrK4AjU8L2D6CniWWBG3QhyjAYSVQb0n/tOMXD8LbfBWunrH8vGqdBVYMuKKRgoyMx1zfhFF/o3gLgz4Ij06+gc=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Level 1" = _t, #"Level 1 Code" = _t, #"Level 2 (Khối/Phòng lớn)" = _t, #"Level 2 Code" = _t, #"Level 3 (Phòng/Bộ phận)" = _t, #"Level 3 Code" = _t, #"Level 4 (Nhóm/Tổ)" = _t, #"Level 4 Code" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Level 1", type text}, {"Level 1 Code", type text}, {"Level 2 (Khối/Phòng lớn)", type text}, {"Level 2 Code", type text}, {"Level 3 (Phòng/Bộ phận)", type text}, {"Level 3 Code", type text}, {"Level 4 (Nhóm/Tổ)", type text}, {"Level 4 Code", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Level 1", "Level 1()"}, {"Level 1 Code", "Level 1"}, {"Level 2 Code", "Level 2"}, {"Level 3 Code", "Level 3"}, {"Level 4 Code", "Level 4"}}),
#"Unpivoted Only Selected Columns" = Table.Unpivot(#"Renamed Columns", {"Level 1", "Level 2", "Level 3", "Level 4"}, "Attribute", "Value"),
#"Renamed Columns1" = Table.RenameColumns(#"Unpivoted Only Selected Columns",{{"Attribute", "Levels"}, {"Value", "Level Codes"}})
in
#"Renamed Columns1"
Then try to create one to many relationship between Org and User Table using Levels Key ColumnI have attached the link to know more about modeling and relationships.
https://learn.microsoft.com/en-gb/power-bi/transform-model/desktop-relationships-understandThanks and Regards,
Sharmila Brisca
GainInsights Solutions
Trusted Microsoft Partner - https://gain-insights.com/partnerships/microsoft/Hope I answered Your Question
- SharmilaBriscaResolver I
Hi AlexAuto2026,
Slicers only interact through model relationships — DAX alone cannot “force” one slicer to filter another reliably.
If you want slicer-to-slicer interaction → you MUST use relationships.
Solution:
In the Advanced Editor, replace the existing code with the following.let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("tVdLb9tGEP4rC51aIIskPvTOh16VSEkk46RIfWApVlxIXArU0oCPRQ45+GKjKIoeglg2AiNFjbqPS0QEOVDw/+A/6SzFxwpVwUKOLxKX8+18s7Pz4suXDSXw5zY9QZKsNB41Nr+yTZGVxj/RCWqTZOmj9XkanzsbOZYHKjwdrl9RNPeSPwFktddnlRAPWi1YWd7dLZomH9G30ZMnB18hK0zjKzRLPuZIQGHJtBpHj3Yb0fOAk6AeoR4aBzb18n2m1G+a8Kx4BFEvWYJYI2n8A0VyuvrdqVBYk2Ex3JhYqUFPc4gmY/XpQ9Ovz9L4F4Lgb7UkwumBXGp/RnLd9kVqfefJDwpyHasHD0uen1tN4z8QQCvi4dd7E8OBlgyxEEgh9ixAn8Lq7jaN39CJYIDM41OfeCT5lSInjd9H3P9cNYM910Wkqtgw62wB+08dDx2n8bt8m8QtscIIPMuSS38nApuHXMcLbtpbAAqYMvoAgp/Xht+9+HkKZyf/EcCLu/IWOLU83JN6FKWrK8ojGQ09fiCWfCi9D9RDych0BIhlFSSXwGv8vLMnp+KtX/lokfzloB7EACC85EIkVQwtPy+cdH2eXBDUCdiMUDfHAAB3+nX0mh1OXUZKzVrPgqfyLYLIT1ef4PD8Yq+cCoVNy9j2Da9+4PEJgi3x66jwvGVgWdvPDJVMCLNnu6RY7bZhZQYO4QB3TOxcCAJsDpSHYhy64fdB6NvUcR9L44VAOmwa+5GavGJMudNo0TmGhkDczFZ5eZEcRo5tRoIitEGKJaW2qehecknRAqjyfR3h+ljIC8sOCJZUHmbKxiwZfdHP77iw00tWDppBaJAvi9hUNazID2qOFZ1k9XAMSVPlBPAazdp7300sVJf1WXLBM3m1DCrevq5mV1CKUC+NPyAKE0HBDxBs9moT7j78W+7pQLxk1f0cdvY1UzCDr2rMsHjBcLzkpmw5rS5vYj3IdsSCqn/BawgvZUuE9CwUv4PfwvmKgrt6bRDej9Xy4PyfBEZLerEvo/A+m1SuI8TubgX2rn64Xd7UbLRgWfvPcYDBSqvOBCX5GzbSCaxeFxutf/V26Cyra4p8UO+XKKw2uRWy7UxdOkaWW04dIMBy8+GpW2FA2Q7u1t7cHYhsHt7XVRWBMfIqAP7VDav4uzofqc2TBXN9JI19Unm9hc1vaiP88/B3LWRG83kQsscddzYfu4upaMaz2plCgaCNf4ZY4wkOg1k1tim8lGmRvdXZ4S0ePjNESZ5t/IPktGhyAMH9+ia3N7kOIXEzR1P4ex8JnF3tvgfuBxOyYMRZCJz9QbuxGaCOgZYKzeWSf3BxtUV1G7T/x0wlZK3Sz3eOpOzuhZo5ik4gBZLfysowkrK4AjU8L2D6CniWWBG3QhyjAYSVQb0n/tOMXD8LbfBWunrH8vGqdBVYMuKKRgoyMx1zfhFF/o3gLgz4Ij06+gc=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Level 1" = _t, #"Level 1 Code" = _t, #"Level 2 (Khối/Phòng lớn)" = _t, #"Level 2 Code" = _t, #"Level 3 (Phòng/Bộ phận)" = _t, #"Level 3 Code" = _t, #"Level 4 (Nhóm/Tổ)" = _t, #"Level 4 Code" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Level 1", type text}, {"Level 1 Code", type text}, {"Level 2 (Khối/Phòng lớn)", type text}, {"Level 2 Code", type text}, {"Level 3 (Phòng/Bộ phận)", type text}, {"Level 3 Code", type text}, {"Level 4 (Nhóm/Tổ)", type text}, {"Level 4 Code", type text}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Level 1", "Level 1()"}, {"Level 1 Code", "Level 1"}, {"Level 2 Code", "Level 2"}, {"Level 3 Code", "Level 3"}, {"Level 4 Code", "Level 4"}}),
#"Unpivoted Only Selected Columns" = Table.Unpivot(#"Renamed Columns", {"Level 1", "Level 2", "Level 3", "Level 4"}, "Attribute", "Value"),
#"Renamed Columns1" = Table.RenameColumns(#"Unpivoted Only Selected Columns",{{"Attribute", "Levels"}, {"Value", "Level Codes"}})
in
#"Renamed Columns1"And create One to Many relationship between Org and User Table using Levels Column.
This will work as per your expectation.
Hope I answered Your Question
Thanks and Regards,
GainInsights Solution
Trusted Fabric Partner - https://gain-insights.com/partnerships/microsoft/
www.gain-insights.com- AlexAuto2026New Member
Thank you for your support, but my customers would prefer not to display the levels. They would rather use an organisational chart with a parent–child structure.