Forum Discussion

Pingu's avatar
Pingu
Regular Visitor
8 years ago
Solved

Keep only first value rest put 0

Hi, I wonder how to get the following: I have a column with a test Nr   Test Nr  Qty t1           5 t1           5 t1           5 t1           5 t2           3 t2           3 I'd like a c...
  • Anonymous's avatar
    Anonymous
    8 years ago

    Hi Pingu,

     

    I think you still need to add an index column to calculate through table, type column obviously not suitable use as index column.

     

    You can enter to query editor to add index column, then use below formula to replace qty value.

    Replaced =
    IF (
        [Index]
            > CALCULATE (
                MIN ( Table1[Index] ),
                FILTER ( ALL ( Table1 ), Table1[Test Nr] = EARLIER ( Table1[Test Nr] ) )
            ),
        0,
        [Qty]
    )
    

     

    Regards,

    Xiaoxin Sheng