Forum Discussion

mhsk's avatar
mhsk
Icon for Helper II rankHelper II
7 years ago
Solved

Obtain single value from column with max values into a new column

Easy question:   how to get just a single value from sumQty_by_item column?   location part qty sum_qty_by_item date expected result 1 111 10 60 01.05.2019 60 2 111 20 60 0...
  • v-cherch-msft's avatar
    7 years ago

    Hi mhsk 

    I would suggest you to add an index column in query editor.Then create the column as below:

    Column =
    VAR pre_sum =
        CALCULATE (
            MAX ( 'Table'[sum] ),
            FILTER ( 'Table', 'Table'[Index] = EARLIER ( 'Table'[Index] ) - 1 )
        )
    RETURN
        IF (
            pre_sum <> 'Table'[sum],
            CALCULATE ( MAX ( 'Table'[sum] ), ALLEXCEPT ( 'Table', 'Table'[sum] ) ),
            0
        )
    

    Regards,