Forum Discussion

PPStar's avatar
PPStar
Icon for Helper V rankHelper V
3 years ago
Solved

Subtract from next row

Hello.    I have the following (summarised table) in power bi   Date      |  QTY      | Order   | Measure 1 1/1/23  |  12          | 56          | 44 1/1/23  | 10           | 47          | 37 ...
  • v-yanjiang-msft's avatar
    3 years ago

    Hi PPStar ,

    According to your description, here's my solution:

    Measure =
    MAXX ( ALL ( 'Table' ), 'Table'[Order] )
        - SUMX (
            FILTER ( ALL ( 'Table' ), 'Table'[Order] >= MAX ( 'Table'[Order] ) ),
            'Table'[QTY]
        )
    

    Get the correct result:

    I attach my sample below for your reference.

     

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

    Best regards,

    Community Support Team_yanjiang