Forum Discussion

Hennadii's avatar
Hennadii
Helper IV
5 years ago
Solved

Swap values in the same row between two columns based on certain condition

Hello,   There is a similar issue I found but there are fixed rows where to swap two values. In my case, I have to define dynamically in which rows to swap the values.   I have a Relations table ...
  • Hennadii's avatar
    Hennadii
    5 years ago

    Thank you MFelix for your reply. Yes, you understood my issue correctly.

    There is an unexpected result in your screenshot - 1st, 2nd, and 4th rows should not be swapped.

     

    Meanwhile, I found more easy way to solve that.

    I added Custom Column with the following formula:

    for item_id_swapped

     

    = if ( List.Contains (Task[id], [item_id] ) ) then [item_id] else [item_to_id]

     

     and for item_to_id_swapped

     

    = if ( List.Contains (Task[id], [item_id] ) ) then [item_to_id] else [item_id]

     

     The result looks as expected