Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Filter two tables based on User input and create combined tables to use in Measure calculation

Hi, I am trying to solve a business problem in PowerBI. I have two data sets that contain forecast details of two different models. The two datasets may have some row items common between them. I ha...
  • Anonymous's avatar
    Anonymous
    6 years ago

    HI Anonymous,

    In fact, it not means append these tables to one on the query editor side.

    For the detailed operations, you can refer to the below steps.
    1. Add a calculated field to your tables combine Forecast and Cost Center fields.

    Merged =
    Table[Forecast] & "/" & Table[Cost Center]
    

    2. Create a calculate table based on two table records.

    Combine Table =
    UNION ( Table1, Table2 )

    3. Extract step1 Merged field from two tables and use them to create a calculated table as the bridge.

    Bridge =
    DISTINCT ( UNION ( ALL ( Table1[Merged] ), ALL ( Table2[Merged] ) ) )
    

    4. Use the Merge field as a relationship key to creating relationships between the bridge and your tables.

    After these steps, you can use the 'Combine Table' field as source of the slicer to filter visuals with table1 and table2 fields.

    Regards,

    Xiaoxin Sheng