Forum Discussion

PhilippeG's avatar
PhilippeG
New Member
1 year ago

Matrix Row Hierarchial Layers Format Options

I want to show a matrix with three different hierarchial layers.
Each layer should have a different format for clarity reasons.

Like this:

Is this possible? As the per row-level for subtotals does not allow to change value formatting.

 



3 Replies

  • ahmedoye's avatar
    ahmedoye
    Responsive Resident

    I have a potential solution here. If it works for you, kindly mark the answer so others with similar challenges can easily find this solution.

     

    To use this solution:

    1. You will create a Measure to apply colors for each step in the hierarchy (Sample meaure below, replace the Table and Column properties to fit your own Model.
    2. Then you will apply conditional formatting on the Cell Elements section of the Matrix formatting option. (Downside is you need to apply the formatting on each of your Values Columns on the Matrix).
    3. Here's the sample measure you can copy to your Model:

      HierarchyColors =

      --Step1 define variables to check scope from lowest level. No need to check for the highest level.
      VAR LowestLevel = ISINSCOPE('Table'[Month])
      VAR SecondLevel = ISINSCOPE('Table'[Quarter])

      --Step2, write switch statement and add colors preferable using HEX codes for easy implementation
      VAR LogicalColors = SWITCH(TRUE(),
                                      LowestLevel, "Red", --red
                                      SecondLevel, "Orange", -- orange
                                      "Blue"    --purple used for the highest level in the hierarchy
                                      )

      --Output the LogicalColors Variable. Then go to Format the Matrix Visual. Go to Cell Elements Sectio
      -- Toggle Font Color On. Then click on the FX to enable conditional formatting. Set it to Field Value, Apply to total and value. Then select this Measure and click OK

      RETURN LogicalColors
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi PhilippeG 

    You can only use conditional formatting for the currently expanded hierarchy.

    For more information, you can refer to the following posts:
    Solved: Conditional Formatting - Microsoft Fabric Community
    Multiple level hierarchy matrix colors - Microsoft Fabric Community

     

    Or you can use the following measure:

    Measure = 
    SWITCH(TRUE(),
    ISINSCOPE('Table'[RowA]),"black",
    ISINSCOPE('Table'[RowB]),"blue",
    ISINSCOPE('Table'[RowC]),"red")

     


    You can then click on the icon below to enter the individual matrix levels:

          
         

     

     

     

    Best Regards,

    Jayleny

     

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

  • Somehow possible to get the headers into the same colors then values using this method?