Matrix Row Custom Grouping

Copper Contributor



I have a problem where I'm trying to customize the order of grouping of the rows in a matrix visual without reversing the labels. It's a bit hard to explain so I have an example.


Screenshot 2023-07-15 161605.png

That's my current result, but I want to make it so that everything that is labeled 'H299' is together even with different names. So lets say the [Names] are 'ITRX', 'Treasury' and [Code] are 'H299', 'B161', etc. I want to group all items with the same code together regardless of their names, but the resulting matrix row expansion will still be in the form of [Name] -> [Code]. Then I want to pick the row label [Name] to be 'ITRX' instead of 'Treasury'. So 'Treasury' never gets picked if it shares the same code with an item with another name.


So the end result would be [ITRX] -> [H299] -> (lists all 4 items with code H299) in my matrix. Any help would be appreciated.

2 Replies


You might add a helper column with a formula that returns the first name for a given code.

 Use that column instead of the name column to group on.


It's better to ask Power BI community here Microsoft Power BI Community - Microsoft Fabric Community

I guess calculated column is required which shows the Name based on that logic, and build matrix using that column.