Forum Discussion
Filtering by Parameter across two identical tables?
- 1 year ago
Hi SevsBo
To synchronize toggling between Value1 and Value2 for both Table1 and Table2 using a single slicer, you can use a Disconnected Table approach which is mentioned below:
1. Create a Parameter Table for Toggle Options:
In Power BI, create a new table called ParameterTable with options Value1 and Value2.
Go to Modeling > New Table and add:ParameterTable = DATATABLE( "Toggle", STRING, { {"Value1"}, {"Value2"} } )2. Create a Measure for Each Table:
For Table1 and Table2, create a measure that checks the toggle selection from ParameterTable and returns either Value1 or Value2 based on that.
In Table1, add this measure:SelectedValue_Table1 = IF( SELECTEDVALUE(ParameterTable[Toggle]) = "Value1", SUM(Table1[Value1]), SUM(Table1[Value2]) )In Table2, add this measure:
SelectedValue_Table2 = IF( SELECTEDVALUE(ParameterTable[Toggle]) = "Value1", SUM(Table2[Value1]), SUM(Table2[Value2]) )3. Use the Parameter as a Slicer:
Place ParameterTable[Toggle] as a slicer on your report page.
Select SelectedValue_Table1 and SelectedValue_Table2 as values for your visuals instead of the original columns.Now, when you change the slicer between Value1 and Value2, it will simultaneously update both Table1 and Table2 to display the selected value across their respective date filters.
Hi SevsBo
To synchronize toggling between Value1 and Value2 for both Table1 and Table2 using a single slicer, you can use a Disconnected Table approach which is mentioned below:
1. Create a Parameter Table for Toggle Options:
In Power BI, create a new table called ParameterTable with options Value1 and Value2.
Go to Modeling > New Table and add:
ParameterTable = DATATABLE(
"Toggle", STRING,
{ {"Value1"}, {"Value2"} }
)
2. Create a Measure for Each Table:
For Table1 and Table2, create a measure that checks the toggle selection from ParameterTable and returns either Value1 or Value2 based on that.
In Table1, add this measure:
SelectedValue_Table1 =
IF(
SELECTEDVALUE(ParameterTable[Toggle]) = "Value1",
SUM(Table1[Value1]),
SUM(Table1[Value2])
)In Table2, add this measure:
SelectedValue_Table2 =
IF(
SELECTEDVALUE(ParameterTable[Toggle]) = "Value1",
SUM(Table2[Value1]),
SUM(Table2[Value2])
)
3. Use the Parameter as a Slicer:
Place ParameterTable[Toggle] as a slicer on your report page.
Select SelectedValue_Table1 and SelectedValue_Table2 as values for your visuals instead of the original columns.
Now, when you change the slicer between Value1 and Value2, it will simultaneously update both Table1 and Table2 to display the selected value across their respective date filters.
Thank you Angith_Nair, that's amazing!
I am getting a small but consistent discrepancy between the results produced this way and with the Parameters within each Table, if I use them as filters. I think I need to review my filters on the visuals but overall this approach worked!