Forum Discussion
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.
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})
4 Replies
- wdx223_DanielCommunity Champion
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})
- BirinderHelper III
Thank you so much daniel. It worked as charm.
However, I have various other columns to execute as same as above.
As I remember the code, the code doesnt mention the column name.
So, how Will I achieve this?
- wdx223_DanielCommunity Champion
what is the frame of your data? and what is the rule of replacement?