Forum Discussion
Dynamic Filtering of Two tables based on One slicer, multiple selected values
- Anonymous3 years ago
Hi mysasai ,
Please try below steps:
1. below is my test table
Table:
Table2:
create with below dax formula:
Table 2 = VALUES('Table'[Name])3. create measure with below dax formula
Measure2 = VAR _str = IF ( ISFILTERED ( 'Table 2'[Name] ), CONCATENATEX ( 'Table 2', [Name],, "" ) ) VAR tmp = { "A", "B", "C", "D", "ABCD", "ABD", "ABC", "ACD", "BCD", "AB", "AC", "AD", "BD", "BC", "CD" } VAR _name = SELECTEDVALUE ( 'Table'[Name] ) RETURN SWITCH ( TRUE (), _str IN tmp, IF ( CONTAINSSTRING ( _str, _name ), 1 ), NOT ( _str IN tmp ), 1 )Measure3 = VAR _str = IF ( ISFILTERED ( 'Table 2'[Name] ), CONCATENATEX ( 'Table 2', [Name],, "" ) ) VAR tmp = { "E", "F", "G", "H", "EFGH", "EFG", "EFH", "EGH", "FGH", "EF", "EG", "EH", "FG", "FH", "GH" } VAR _name = SELECTEDVALUE ( 'Table'[Name] ) RETURN SWITCH ( TRUE (), _str IN tmp, IF ( CONTAINSSTRING ( _str, _name ), 1 ), NOT ( _str IN tmp ), 1 )3. add two table visual with Table fields and add above measure to both visual filter pane, add aslicer visual with Table2 field, cancel the interaction between two table visual
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find itmore quickly.
Hi mysasai ,
Please try below steps:
1. below is my test table
Table:
Table2:
create with below dax formula:
Table 2 = VALUES('Table'[Name])
3. create measure with below dax formula
Measure2 =
VAR _str =
IF ( ISFILTERED ( 'Table 2'[Name] ), CONCATENATEX ( 'Table 2', [Name],, "" ) )
VAR tmp = {
"A",
"B",
"C",
"D",
"ABCD",
"ABD",
"ABC",
"ACD",
"BCD",
"AB",
"AC",
"AD",
"BD",
"BC",
"CD"
}
VAR _name =
SELECTEDVALUE ( 'Table'[Name] )
RETURN
SWITCH (
TRUE (),
_str IN tmp, IF ( CONTAINSSTRING ( _str, _name ), 1 ),
NOT ( _str IN tmp ), 1
)
Measure3 =
VAR _str =
IF ( ISFILTERED ( 'Table 2'[Name] ), CONCATENATEX ( 'Table 2', [Name],, "" ) )
VAR tmp = {
"E",
"F",
"G",
"H",
"EFGH",
"EFG",
"EFH",
"EGH",
"FGH",
"EF",
"EG",
"EH",
"FG",
"FH",
"GH"
}
VAR _name =
SELECTEDVALUE ( 'Table'[Name] )
RETURN
SWITCH (
TRUE (),
_str IN tmp, IF ( CONTAINSSTRING ( _str, _name ), 1 ),
NOT ( _str IN tmp ), 1
)
3. add two table visual with Table fields and add above measure to both visual filter pane, add aslicer visual with Table2 field, cancel the interaction between two table visual
Please refer the attached .pbix file.
Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it
more quickly.
- mysasai3 years agoFrequent Visitor
Anonymous , thanks for the solution. This works perfectly.