Forum Discussion

101Mathew's avatar
101Mathew
Advocate V
7 months ago
Solved

Matrix - formatting and Sorting

There appears to be no method to format column vertical lines; i would love to be able to format the top level of a column hierarchy - to have a alternating colour background on the that level of text, also to have thicker vertical lines

it also seems mad that we don't appear to have a method to sort the column order

  • 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.

     

8 Replies

  • 101Mathew Your observation is correct. These are current Power BI limitations.

    Formatting column hierarchy headers:

    • You cannot format different levels of a column hierarchy separately

    • No option to apply alternating background colors to top-level column headers

    • Vertical grid lines cannot be made thicker per column or hierarchy level

    • Only global grid on/off and color settings are available

    • Header formatting applies to all column levels equally

    Column order sorting:

    • There is no direct UI option to manually reorder columns in a matrix

    • Column order follows:

      • Natural sort of the column field

      • Or “Sort by column” from the data model

    • You cannot drag and drop column order like rows

    Workarounds:

    • Create a custom sort column and use “Sort by column”

    • Prefix column names with numbers (01, 02, 03)

  • Hi 101Mathew 

    There is no currently option to change the format of each column hierarchy.  Formatting is applied to the whole of the column header.

  • 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]






     

    • 101Mathew's avatar
      101Mathew
      Advocate V

      Thank you sorry I should have stated that I need to have measure switched to rows

      • GrowthNatives's avatar
        GrowthNatives
        Super 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

  • v-tejrama's avatar
    v-tejrama
    Community Support

    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.

     

    • 101Mathew's avatar
      101Mathew
      Advocate V

      Thank you, this was my findings also, I was wondering if there was some type of solution - I've raised an suggestion in the Idea's section yesterday for this -

      My issue is compounded by the need to switch the measures into rows

  • I forgot to mention that coumn headers are sorted either alphabetically in chronological order (no optino to reverse it) or based on the defined custom sort for that column.