Forum Discussion
Conditionally duplicate text in one or two columns across 3 columns, maybe
- 3 years ago
hope this can help
NewStep=#table(Table.ColumnNames(PreviousStepName),Table.ToList(PreviousStepName,each if List.Contains({"",null,0,"0","quiet"},_{1}) then List.Repeat({_{0}},3) else if List.Contains({"",null,0,"0","quiet"},_{2}) then {_{0}}&List.FirstN(_,2)))
Thanks for your patience and continued assistance. The easiest answer is the difference between this 20% and the 10% that doesn't need to be adjusted, so I'll start there.
I work with the parent company, and we don't need our name included in the pivot table I'm supposed to feed the data into. If I boil it down, there's 1 company name at the top of the hierarchy that we don't need to include in our 3 columns, the parent company name "quiet" or the value 0 which are in column C.
In the 10% of good data that doesn't need to be touched, the parent company name isn't listed because there are 3 child companies under us that fill the 3 columns of company hierarchy.
At first I was only thinking of tackling all of this data in one sheet, but I imagine now I can easily filter the 10% perfect companies out of the list and we then only deal with the 50% and 20% data.
In 20% of data I want to automate cleaning, there's only 2 child company names so our parent company name is in column C. The goal is to move the first level child company from column B to column C and to duplicate the second level child company in column A to column B.
I hope this gives you an idea of what step commands you can provide that could help
hope this can help
NewStep=#table(Table.ColumnNames(PreviousStepName),Table.ToList(PreviousStepName,each if List.Contains({"",null,0,"0","quiet"},_{1}) then List.Repeat({_{0}},3) else if List.Contains({"",null,0,"0","quiet"},_{2}) then {_{0}}&List.FirstN(_,2)))