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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
BIUser1998
Helper I
Helper I

Subheaders from two tables in PowerBI Matrix Table

I have two data tables

CategoryClassValueFiscal Year
AmericaA352022
CanadaA492022
FranceA122022
ChinaA3242022
AmericaB752022
CanadaB122022
FranceB212022
ChinaB63

2022

 

and 

CategoryClassValueFiscal Year
AmericaA452023
CanadaA592023
FranceA222023
ChinaA3342023
AmericaB852023
CanadaB222023
FranceB312023
ChinaB732023

 

And I want a Matrix table to look like

BIUser1998_1-1712253326048.png

I tried a couple of things but they didn't work out. Any ideas as to how I can achieve this? Also, is it possible to have one table by merging the two tables based on the category table?

 

Thank you for the help!

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi  @BIUser1998 ,

I’d like to acknowledge the valuable input provided by the  @amitchandak . His initial ideas were instrumental in guiding my approach. However, I noticed that further details were needed to fully understand the issue.  In my investigation, I took the following steps:  

I create two tables as you mentioned.

vyilongmsft_5-1712287202728.png

vyilongmsft_6-1712287215000.png

Then I go to the Power Query and use the Appended Queries.

vyilongmsft_7-1712287239943.png

Then I create two measures named A and B.

A = MAXX(FILTER('T1','T1'[Class]="A"),'T1'[Value])
B = MAXX(FILTER('T1','T1'[Class]="B"),'T1'[Value])

Finally I use the matrix visual and get what you want.

vyilongmsft_8-1712287387295.png

vyilongmsft_9-1712287409715.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi @Anonymous, this worked like a charm. I have an additional doubt though. Since there are two tables, there are some rows common and some distinct rows, is there any way I can show in which all tables which country is available? Something like shown in the screenshot attached?

BIUser1998_0-1712594105411.png

 

View solution in original post

4 REPLIES 4
BIUser1998
Helper I
Helper I

@amitchandak Thank you for the valuable input!

Anonymous
Not applicable

Hi  @BIUser1998 ,

I’d like to acknowledge the valuable input provided by the  @amitchandak . His initial ideas were instrumental in guiding my approach. However, I noticed that further details were needed to fully understand the issue.  In my investigation, I took the following steps:  

I create two tables as you mentioned.

vyilongmsft_5-1712287202728.png

vyilongmsft_6-1712287215000.png

Then I go to the Power Query and use the Appended Queries.

vyilongmsft_7-1712287239943.png

Then I create two measures named A and B.

A = MAXX(FILTER('T1','T1'[Class]="A"),'T1'[Value])
B = MAXX(FILTER('T1','T1'[Class]="B"),'T1'[Value])

Finally I use the matrix visual and get what you want.

vyilongmsft_8-1712287387295.png

vyilongmsft_9-1712287409715.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous, this worked like a charm. I have an additional doubt though. Since there are two tables, there are some rows common and some distinct rows, is there any way I can show in which all tables which country is available? Something like shown in the screenshot attached?

BIUser1998_0-1712594105411.png

 

amitchandak
Super User
Super User

@BIUser1998 , Option 1 append two tables in Power query

Append Tables (Power Query)
https://www.youtube.com/watch?v=KyXIDInZMxk&list=PLPaNVDMhUXGaaqV92SBD5X2hk3TMNlHhb&index=15

 

Or create common dimensions like Category , class and fiscal year and join with both tables and use them for analysis

 

Example dim

Category = distinct(union(distinct(Table1[Category]),distinct(Table2[Category])))

 

Power BI- DAX: When I asked you to create common tables: https://youtu.be/a2CrqCA9geM
https://medium.com/@amitchandak/power-bi-when-i-asked-you-to-create-common-tables-a-quick-dax-soluti...

 

Power BI- Power Query: When I asked you to create common tables: https://youtu.be/PqfGW6pl1Sw

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.