Forum Discussion

Birinder's avatar
Birinder
Icon for Helper III rankHelper III
5 years ago
Solved

How to get rid of duplicates values without removing values adjacent to them.

Suppose, I have a table like this:     And I want to turn it into this:       Is there any way of doing so. I will appreciate all the help. Thank you In Advance.
  • wdx223_Daniel's avatar
    5 years ago

    NewStep=#table(Table.ColumnNames(PreviousStepName),List.Accumulate(Table.ToRows(PreviousStepName),{{},""},(x,y)=>{x{0}&{List.RemoveLastN(y,1)&{if List.Last(y)=x{1} then null else List.Last(y)}},List.Last(y)}){0})