Forum Discussion
Two column with grouped rows
Hi,
Is it possible to create below matrix in power BI?
Thanks for that. It really helps.
Caveat: this example follows the criteria laid out in your latest data sample. In other words, the % split by cost type is the same for each company. If the split is different for each company, we need a table with the detailed % split by cost type and by company to make the correct calculations
Ok, here is one way. You need to create intermediate tables in Power Query for the % calculations (which involves custom - calculated- columns and unpivotting) to finally append them all in a final table. Just beware that every cost type must have a % split summing to 100% (I've added a new calulation in the Spare Parts Table costs for the 80% not accounted for in your example). This way the sum of cost breakdown will equal the sum of the corresponding amount.
The table looks like this:
You can then use the Cost Type and Cost Breakdown fields to structure the matrix. The measure is a simple sum:
By cost type
By company
I've attached the sample PBIX file
13 Replies
- amitchandakSuper User
NishPatel , if X,Y,Z are measures or values of column and 001 , 002 are also values of a column. this should work(similar, not same) .
But you need to share sample raw data.
https://docs.microsoft.com/en-us/power-bi/visuals/desktop-matrix-visual
- NishPatelResolver II
Hi Amit,
I am not sure how to upload a file here and that's why i pasting below sample raw data. I appreciate your help.
Year Month Amount Type Company InvoiceNo 2021 Apr 205 X Company A 001 2021 Apr 627 Y Company A 001 2021 Apr 583 Z Company A 001 2021 Apr 738 X Company B 001 2021 Apr 160 Y Company B 001 2021 Apr 374 Z Company B 001 2021 Apr 291 X Company C 001 2021 Apr 442 Y Company C 001 2021 Apr 769 Z Company C 001 2021 Apr 647 X Company A 002 2021 Apr 954 Y Company A 002 2021 Apr 153 Z Company A 002 2021 Apr 185 X Company B 002 2021 Apr 983 Y Company B 002 2021 Apr 923 Z Company B 002 2021 Apr 233 X Company C 002 2021 Apr 297 Y Company C 002 2021 Apr 149 Z Company C 002 2021 May 314 X Company A 003 2021 May 747 Y Company A 003 2021 May 784 Z Company A 003 2021 May 438 X Company B 003 2021 May 540 Y Company B 003 2021 May 223 Z Company B 003 2021 May 426 X Company C 003 2021 May 640 Y Company C 003 2021 May 360 Z Company C 003 2021 May 907 X Company A 004 2021 May 879 Y Company A 004 2021 May 865 Z Company A 004 2021 May 603 X Company B 004 2021 May 622 Y Company B 004 2021 May 223 Z Company B 004 2021 May 580 X Company C 004 2021 May 953 Y Company C 004 2021 May 682 Z Company C 004 2021 Jun 142 X Company A 005 2021 Jun 122 Y Company A 005 2021 Jun 887 Z Company A 005 2021 Jun 510 X Company B 005 2021 Jun 925 Y Company B 005 2021 Jun 614 Z Company B 005 2021 Jun 563 X Company C 005 2021 Jun 230 Y Company C 005 2021 Jun 240 Z Company C 005 2021 Jun 144 X Company A 006 2021 Jun 679 Y Company A 006 2021 Jun 216 Z Company A 006 2021 Jun 257 X Company B 006 2021 Jun 820 Y Company B 006 2021 Jun 928 Z Company B 006 2021 Jun 309 X Company C 006 2021 Jun 868 Y Company C 006 2021 Jun 853 Z Company C 006 2021 Jul 349 X Company A 007 2021 Jul 853 Y Company A 007 2021 Jul 664 Z Company A 007 2021 Jul 543 X Company B 007 2021 Jul 829 Y Company B 007 2021 Jul 700 Z Company B 007 2021 Jul 387 X Company C 007 2021 Jul 789 Y Company C 007 2021 Jul 382 Z Company C 007 2021 Jul 172 X Company A 008 2021 Jul 113 Y Company A 008 2021 Jul 657 Z Company A 008 2021 Jul 577 X Company B 008 2021 Jul 201 Y Company B 008 2021 Jul 691 Z Company B 008 2021 Jul 889 X Company C 008 2021 Jul 935 Y Company C 008 2021 Jul 620 Z Company C 008 2021 Aug 239 X Company A 009 2021 Aug 216 Y Company A 009 2021 Aug 586 Z Company A 009 2021 Aug 748 X Company B 009 2021 Aug 759 Y Company B 009 2021 Aug 848 Z Company B 009 2021 Aug 309 X Company C 009 2021 Aug 202 Y Company C 009 2021 Aug 118 Z Company C 009 2021 Aug 770 X Company A 010 2021 Aug 777 Y Company A 010 2021 Aug 738 Z Company A 010 2021 Aug 476 X Company B 010 2021 Aug 1000 Y Company B 010 2021 Aug 763 Z Company B 010 2021 Aug 194 X Company C 010 2021 Aug 458 Y Company C 010 2021 Aug 902 Z Company C 010 - PaulDBrownCommunity Champion
Ideally (best practices) you sould create dimension tables for the non-value columns (those you will be using to filter by). In this example I've only created a dimension table for month (to ensure proper sorting)
Then with a simple sum measure
Sum Amount = SUM(FactTable[Amount])and this structure for a matrix visual
and drilling down on rows and columns
you get