Forum Discussion

Danielwood's avatar
Danielwood
Helper I
3 years ago
Solved

Combining data into one bar chart

Hi,   I'm quite new to Power BI so this may be a stupid question.   I have a few tables that ideally I want to link to show one bar graph of data.   Table one has a list of 25 unique values in ...
  • jgeddes's avatar
    3 years ago

    Sure thing.

    The basic idea is that we need to unpivot both tables and then build a relationship between them.

    To unpivot the tables go into Power Query via the Transform data icon

    On Table1 select the Product column and then from the Transform portion of the ribbon select Unpivot Other Columns. 

    I renamed the resulting "Attribute" column as "Category"

    Do the same for Table2 selecting the "Code" column and unpivoting the other columns

    In this case I rename the "Attribute" column to "Product" to match the column name in Table1

    Close and Apply these changes to go back into the BI screen.

    You can now set a Many to Many relationship between the two tables using the product columns. It will filter in both directions.

    The measure I used was;

    Both Y =
    CALCULATE(
        COUNT(Table1[Category]),
        FILTER(Table2,Table2[Value]="Y"),
        FILTER(Table1,Table1[Value]="Y")
    )
    Hope this helps.