Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
Upali63
Helper II
Helper II

Formatting rows in Matrix

Hi,

 

I have cretaed a matrix for Profit and loss statment and my output report is like the one shown below

 

Upali63_0-1697016861008.png

 

But I find difficult to format some selected Rows in line with the image shown below B/G color ,Font size,Bold font. Kindly help me to achieve it. Link for my Power Bi file is also given below

Upali63_1-1697018012524.png

 

https://drive.google.com/file/d/1moDryrJEZcQpr2JO4SiMwZCwdLHH3LuZ/view?usp=sharing

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Upali63 ,

 

I suggest you to use "stepped layout" to transform your visual.

vrzhoumsft_0-1697782447467.png

And turn on Row subtotals.

vrzhoumsft_1-1697782483198.png

Measure:

PL Total = 
SUMX (
    SUMMARIZE (
        'PL Account',
        'PL Account'[P&L Category],
        'PL Account'[Account],
        "Switch",
            SWITCH (
                TRUE (),
                MAX ( 'PL Account'[Order_id] ) = 3,
                    CALCULATE (
                        [PL Amount],
                        FILTER ( ALL ( 'PL Account' ), 'PL Account'[Order_id] IN { 1, 2 } )
                    ),
                MAX ( 'PL Account'[Order_id] ) = 10,
                    CALCULATE (
                        [PL Amount],
                        FILTER ( ALL ( 'PL Account' ), 'PL Account'[Order_id] IN { 5, 6, 7, 8, 9 } )
                    ),
                MAX ( 'PL Account'[Order_id] ) = 11,
                    CALCULATE (
                        [PL Amount],
                        FILTER ( ALL ( 'PL Account' ), 'PL Account'[Order_id] IN { 1, 2 } )
                    )
                        - CALCULATE (
                            [PL Amount],
                            FILTER ( ALL ( 'PL Account' ), 'PL Account'[Order_id] IN { 5, 6, 7, 8, 9 } )
                        ),
                MAX ( 'PL Account'[Order_id] ) = 15,
                    CALCULATE (
                        [PL Amount],
                        FILTER ( ALL ( 'PL Account' ), 'PL Account'[Order_id] IN { 1, 2 } )
                    )
                        - CALCULATE (
                            [PL Amount],
                            FILTER (
                                ALL ( 'PL Account' ),
                                'PL Account'[Order_id] IN { 5, 6, 7, 8, 9, 13, 14 }
                            )
                        ),
                MAX ( 'PL Account'[Order_id] ) = 18,
                    CALCULATE (
                        [PL Amount],
                        FILTER ( ALL ( 'PL Account' ), 'PL Account'[Order_id] IN { 1, 2 } )
                    )
                        - CALCULATE (
                            [PL Amount],
                            FILTER (
                                ALL ( 'PL Account' ),
                                'PL Account'[Order_id] IN { 5, 6, 7, 8, 9, 13, 14, 17 }
                            )
                        ),
                [PL Amount]
            )
    ),
    [Switch]
)
Measure Filter = 
IF(CONTAINSSTRING(MAX('PL Account'[Account]),"Total") || MAX('PL Account'[Account]) = "",0,1)

Add Measure Filter into visual level filter and set it to show items when value = 1.

Result is as below.

vrzhoumsft_2-1697782556216.png

 

Best Regards,
Rico Zhou

 

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

 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Upali63 ,

 

I suggest you to use "stepped layout" to transform your visual.

vrzhoumsft_0-1697782447467.png

And turn on Row subtotals.

vrzhoumsft_1-1697782483198.png

Measure:

PL Total = 
SUMX (
    SUMMARIZE (
        'PL Account',
        'PL Account'[P&L Category],
        'PL Account'[Account],
        "Switch",
            SWITCH (
                TRUE (),
                MAX ( 'PL Account'[Order_id] ) = 3,
                    CALCULATE (
                        [PL Amount],
                        FILTER ( ALL ( 'PL Account' ), 'PL Account'[Order_id] IN { 1, 2 } )
                    ),
                MAX ( 'PL Account'[Order_id] ) = 10,
                    CALCULATE (
                        [PL Amount],
                        FILTER ( ALL ( 'PL Account' ), 'PL Account'[Order_id] IN { 5, 6, 7, 8, 9 } )
                    ),
                MAX ( 'PL Account'[Order_id] ) = 11,
                    CALCULATE (
                        [PL Amount],
                        FILTER ( ALL ( 'PL Account' ), 'PL Account'[Order_id] IN { 1, 2 } )
                    )
                        - CALCULATE (
                            [PL Amount],
                            FILTER ( ALL ( 'PL Account' ), 'PL Account'[Order_id] IN { 5, 6, 7, 8, 9 } )
                        ),
                MAX ( 'PL Account'[Order_id] ) = 15,
                    CALCULATE (
                        [PL Amount],
                        FILTER ( ALL ( 'PL Account' ), 'PL Account'[Order_id] IN { 1, 2 } )
                    )
                        - CALCULATE (
                            [PL Amount],
                            FILTER (
                                ALL ( 'PL Account' ),
                                'PL Account'[Order_id] IN { 5, 6, 7, 8, 9, 13, 14 }
                            )
                        ),
                MAX ( 'PL Account'[Order_id] ) = 18,
                    CALCULATE (
                        [PL Amount],
                        FILTER ( ALL ( 'PL Account' ), 'PL Account'[Order_id] IN { 1, 2 } )
                    )
                        - CALCULATE (
                            [PL Amount],
                            FILTER (
                                ALL ( 'PL Account' ),
                                'PL Account'[Order_id] IN { 5, 6, 7, 8, 9, 13, 14, 17 }
                            )
                        ),
                [PL Amount]
            )
    ),
    [Switch]
)
Measure Filter = 
IF(CONTAINSSTRING(MAX('PL Account'[Account]),"Total") || MAX('PL Account'[Account]) = "",0,1)

Add Measure Filter into visual level filter and set it to show items when value = 1.

Result is as below.

vrzhoumsft_2-1697782556216.png

 

Best Regards,
Rico Zhou

 

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

 

MFelix
Super User
Super User

Hi @Upali63 ,

 

The formulas you are using in terms of the colours are correct so if you use them as your condittional formatting they will highlight the numbers, however there is no chance to format the bold font size and so on since the totals are part of your values.

 

The other questions ir regarding the headers that don't have the option to be condittional formatted so you can't have that exactly look and feel has you are presenting on the screen shot.

 


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português





Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.