Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Subtotal within P&L

Hello,   Please can I get some help in getting a subtotal for 'Total Cost of Sales' to appear in the matrix table below?     Total revenue and total units traded are currently data values within ...
  • v-easonf-msft's avatar
    v-easonf-msft
    4 years ago

    Hi, Anonymous 

    Please try formula as below:

    Output = 
    VAR _Total_cost_of_sales =
        CALCULATE (
            SUM ( 'Project Level Data'[Value] ),
            FILTER (
                ALL ( 'P&L Presentation' ),
                'P&L Presentation'[Profit and loss itesms]
                    IN { "Land Traded", "WIP Traded", "Provisions", "Abort Costs" }
            )
        )
    VAR _Total_revenue =
        CALCULATE (
            SUM ( 'Project Level Data'[Value] ),
            FILTER (
                ALL ( 'P&L Presentation' ),
                'P&L Presentation'[Profit and loss itesms] = "Total Revenue"
            )
        )
    VAR _Total_Trading_Profit = _Total_cost_of_sales + _Total_revenue
    VAR _Trading_Profit_percent = _Total_Trading_Profit / _Total_revenue
    RETURN
        SWITCH (
            SELECTEDVALUE ( 'P&L Presentation'[Profit and loss itesms] ),
            "Total Cost of Sales", _Total_cost_of_sales,
            "Total Trading Profit", _Total_Trading_Profit,
            "Trading Profit%", FORMAT ( _Trading_Profit_percent, "Percent" ),
            SUM ( 'Project Level Data'[Value] )
        )

    If it doesn't work, please share your sample file for further research.

    Best Regards,
    Community Support Team _ Eason