Forum Discussion
Matrix - formatting and Sorting
- 7 months ago
Hi 101Mathew ,
This behavior is a current limitation of the Matrix visual. Power BI doesn’t support applying different formatting at individual column hierarchy levels such as alternating header colors or thicker vertical gridline, and column groups can’t be manually reordered. The order of hierarchy fields is always driven by the model’s sort logic , alphabetical or Sort by Column. While measures can be reordered by drag and drop in the Values well, this capability does not apply to column hierarchy fields.As a workaround, you can use a dedicated sort column in the model, or replace the column hierarchy with individual measures so you can control their order explicitly. Features like Field Parameters or dynamic format strings can help with dynamic selection or value formatting, but they don’t solve the core limitations around hierarchy level formatting or custom column ordering in a Matrix at this time.
Hi 101Mathew , You are correct Power BI does not support custom column ordering in a Matrix the way it supports row ordering
But you can follow these steps that might work in favour :
1. Fake column hierarchy using measures
Instead of a column hierarchy, you:
Create separate measures for each logical column
Place them side-by-side in Values
Control order manually
Example :
Sales_2024 = CALCULATE([Sales], 'Date'[Year] = 2024)
Sales_2025 = CALCULATE([Sales], 'Date'[Year] = 2025)
2. Add a “sort index” column (only works for rows)
If your complaint is partly about column categories, the only sortable alternative is to pivot them into rows.
Steps:
Unpivot data so categories become rows
Add numeric SortOrder column
Sort category by SortOrder
Use Matrix rows instead of columns
3. Simulated top-level header styling
You can fake top-level formatting by:
Adding the top hierarchy field as:
A row
With stepped layout OFF
Turning off subtotals
Using conditional formatting on row background:
DAX
IsTopLevel = IF( ISINSCOPE('Table'[Child]), 0, 1 )Then apply:
Background color when IsTopLevel = 1
Transparent otherwise
4. Vertical separators using blank columns
To simulate thicker vertical lines:
Add a dummy measure:
DAX
Spacer = ""Place it between columns
Set background color darker
Reduce column width
⭐Hope this solution helps you make the most of Power BI! If it did, click 'Mark as Solution' to help others find the right answers.
💡Found it helpful? Show some love with kudos 👍 as your support keeps our community thriving!
🚀Let’s keep building smarter, data-driven solutions together!🚀 [Explore More]
Thank you sorry I should have stated that I need to have measure switched to rows
- GrowthNatives7 months agoSuper User
101Mathew , Power BI does support moving measures from columns to rows, but it is controlled by a Matrix-only setting.
Step-by-step
Select your Matrix visual
Open Format pane
Go to Values
Toggle Show on rows = On
Result:
Measures appear as row headers
Columns now represent only column fields
Measures behave like categorical row members
Measure ordering (finally controllable)
Measures appear in the order they are listed in the Values well
You can:
Drag measures up/down to reorder
Remove/reinsert measures in a fixed order
You can now apply row-level background formatting, which affects each measure row independently.
- Workaround — fake measure group headers
Create a text measure to act as a group header.DAX Revenue Header = "REVENUE"Place it above revenue-related measures in the Values well.
Then format:
Bold font
Dark background
Disable totals for that row
To hide values:
Conditional formatting → Font color = background color
Or return BLANK() for numeric visuals