Forum Discussion

SevsBo's avatar
SevsBo
Icon for Responsive Resident rankResponsive Resident
1 year ago
Solved

Filtering by Parameter across two identical tables?

I have two identical tables, let's call them Table1 and Table2, that have Date1, Date2, and Value1, Value2, as the points of interest. The tables are linked by a common date filter, so that Table1 is...
  • Angith_Nair's avatar
    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.