Forum Discussion

lucausa75's avatar
lucausa75
Frequent Visitor
6 years ago
Solved

Error on SubTotal and GrandTotal calculation

Dear all, I have a table like this: and I would like to have a grouping like this:   As you can the column called "UNIT_QTY" gets the correct values but the subtotal and the total are...
  • v-gizhi-msft's avatar
    v-gizhi-msft
    6 years ago

    Hi,

     

    Please try these measures:

    UNIT_QTY =
    SUMX (
        GROUPBY (
            'Table',
            'Table'[CHANNEL],
            'Table'[SERVICE],
            'Table'[MODEL],
            'Table'[CODE]
        ),
        CALCULATE ( AVERAGE ( 'Table'[QTY] ) )
    )
    AVG PRICE =
    SUMX (
        GROUPBY (
            'Table',
            'Table'[CHANNEL],
            'Table'[SERVICE],
            'Table'[MODEL],
            'Table'[CODE]
        ),
        CALCULATE ( AVERAGE ( 'Table'[PRICE] ) )
    )

    The result shows:

    Here is my test pbix file:

    pbix 

    Hope this helps.

     

    Best Regards,

    Giotto