Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

View all the Fabric Data Days sessions on demand. View schedule

Reply
Danielwood
Helper I
Helper I

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 column A, then in columns B-E it has 4 groups (eg Fruit, Veg, Grain, Other). For every entry in column A, it will have a Y or N if its part of the 4 groups. 

 

Table 2 then has some other unique references in column A, eg a product code. Then in columns B onwards it has those 25 unique values from Table 1. For each product, it has a Y or N if its part of the 25 unique values.

 

What I then want to do is show for the 4 groups, how many products have a Y against a unique value (in Table 2)  that then also has a Y in that group (in Table 1).

 

I've probably explained that terribly, but hopefully you can help. 

 

Thanks

 

Dan

1 ACCEPTED SOLUTION
jgeddes
Super User
Super User

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. 

jgeddes_0-1662578145058.png

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

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

jgeddes_1-1662578275554.png

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.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

3 REPLIES 3
jgeddes
Super User
Super User

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. 

jgeddes_0-1662578145058.png

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

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

jgeddes_1-1662578275554.png

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.




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





jgeddes
Super User
Super User

If I understand correctly, your data looks something like;

jgeddes_0-1662576940327.png

jgeddes_1-1662576962095.png

with the second table continuing to include up to SKU 25.

And your desired result is something like

jgeddes_2-1662577014665.png

Correct?





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Hi,

Yeah that's the kind of thing I'm after. Are you able to explain how you did that please?

 

The source data is in a Microsoft access database if that helps.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors