Forum Discussion

azaterol's avatar
azaterol
Icon for Helper V rankHelper V
4 years ago
Solved

Please help for stock problem

Hello everyone, I have given the following table. When I sort the table by date in Power BI, this comes up. The order is absolutely correct and is exactly what it is supposed to be. I created the c...
  • v-yanjiang-msft's avatar
    4 years ago

    Hi azaterol ,

    Has your problem been solved? According to your snapshot, if you want to calculate the accumulated stock based on the date and ID, as you have create a index column seams based on date, you can simply create a measure:

    Accumulated Stock =
    SUMX (
        FILTER (
            ALL ( 'Table' ),
            'Table'[ID] = MAX ( 'Table'[ID] )
                && 'Table'[Index] <= MAX ( 'Table'[Index] )
        ),
        [Stock]
    )
    

    Best Regards,
    Community Support Team _ kalyj

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