Forum Discussion

Upali63's avatar
Upali63
Helper II
2 years ago
Solved

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     But I find difficult to format some selected Rows in line with the image sho...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Upali63 ,

     

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

    And turn on Row subtotals.

    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.

     

    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.