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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Marico
Helper IV
Helper IV

Combined Matrix

Hi - My sample data looks like the following:

 

SalesInternal/ ExternalCategoryFlag
10InternalCat1Flag 1
20ExternalCat1Flag 1
30InternalCat2Flag 1
40ExternalCat2Flag 1
50InternalCat1Flag 2
60ExternalCat1Flag 2
70InternalCat2Flag 2
80ExternalCat2Flag 2

 

I want to create a combined table like below based on the following two sub tables:

 

CategoryFlag 1Flag 2
InternalExternalInternalExternal
Cat110205060
Cat230407080

 

CategoryTotal no. of sales
InternalExternal
Cat16080
Cat2100120

 

Final output table needed:

 

CategoryTotal no. of salesFlag 1Flag 2
InternalExternalInternalExternalInternalExternal
Cat1608010205060
Cat210012030407080
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Marico ,

 

The following virtual table can be created with the help of the NATURALINNERJOIN function:

FlagTable = 
SUMMARIZE(
    'SalesData',
    'SalesData'[Category],
    'SalesData'[Flag],
    'SalesData'[Internal/ External],
    "SalesAmount", SUM('SalesData'[Sales])
)

vkongfanfmsft_1-1730106260540.png

TotalSalesTable = 
SUMMARIZE(
    'SalesData',
    'SalesData'[Category],
    'SalesData'[Internal/ External],
    "TotalSales", SUM('SalesData'[Sales])
)

vkongfanfmsft_2-1730106282089.png

FinalOutputTable = 
NATURALINNERJOIN(
    SUMMARIZE(
        'SalesData',
        'SalesData'[Category],
        'SalesData'[Internal/ External],
        "TotalSales", SUM('SalesData'[Sales])
    ),
    SUMMARIZE(
        'SalesData',
        'SalesData'[Category],
        'SalesData'[Flag],
        'SalesData'[Internal/ External],
        "FlagSales", SUM('SalesData'[Sales])
    )
)

vkongfanfmsft_3-1730106301148.png

 

vkongfanfmsft_0-1730106176328.png

 

Best Regards,
Adamk Kong

 

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

7 REPLIES 7
Anonymous
Not applicable

Hi @Marico ,

 

The following virtual table can be created with the help of the NATURALINNERJOIN function:

FlagTable = 
SUMMARIZE(
    'SalesData',
    'SalesData'[Category],
    'SalesData'[Flag],
    'SalesData'[Internal/ External],
    "SalesAmount", SUM('SalesData'[Sales])
)

vkongfanfmsft_1-1730106260540.png

TotalSalesTable = 
SUMMARIZE(
    'SalesData',
    'SalesData'[Category],
    'SalesData'[Internal/ External],
    "TotalSales", SUM('SalesData'[Sales])
)

vkongfanfmsft_2-1730106282089.png

FinalOutputTable = 
NATURALINNERJOIN(
    SUMMARIZE(
        'SalesData',
        'SalesData'[Category],
        'SalesData'[Internal/ External],
        "TotalSales", SUM('SalesData'[Sales])
    ),
    SUMMARIZE(
        'SalesData',
        'SalesData'[Category],
        'SalesData'[Flag],
        'SalesData'[Internal/ External],
        "FlagSales", SUM('SalesData'[Sales])
    )
)

vkongfanfmsft_3-1730106301148.png

 

vkongfanfmsft_0-1730106176328.png

 

Best Regards,
Adamk Kong

 

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

 

Ashish_Mathur
Super User
Super User

Hi,

Your data tables has not been pasted properly in your original post - only the first one is clear.  


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Marico
Helper IV
Helper IV

 Hi @dharmendars007 - Sorry, I am new to Power BI, all these calculations so would be created through a "New Table measure"? Alos, can't we directly create the final table using summarize?

dharmendars007
Memorable Member
Memorable Member

Hello @Marico , 

 

Step1  -You will need to calculate the total sales grouped by Category and Internal/ExternaL.

 

dharmendars007_0-1728309988267.png

 

Step 2 - Create a Masure for both Flag1 and Flag2

 

dharmendars007_1-1728310091383.png

 

dharmendars007_2-1728310110073.png

 

Step3 = Create a final Table using summarize then use the same to plot in the table visual like you wish in output

 

dharmendars007_3-1728310182356.png

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes 👍 are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

 

 

@dharmendars007 I am not able to create the matrix like the below from output of summarize table:

 

Marico_0-1728318015019.png

Could you please share a sample file? Thanks a lot in advance.

Your desired output doesn't seem to make sense. What would you change on the below (which was done without coding)

 

lbendlin_0-1728330127854.png

 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.