How to iterate unique values ​​and insert rows

%3CLINGO-SUB%20id%3D%22lingo-sub-1818061%22%20slang%3D%22en-US%22%3EHow%20to%20iterate%20unique%20values%20and%20insert%20rows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1818061%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20everyone%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20a%20huge%20dataset%20with%20information%20about%20different%20product%20id's.%20One%20of%20the%20columns%20has%20information%20about%20allergens%20and%20I%20want%20to%20add%20four%20new%20allergen%20values%20(Paran%C3%B8tter%2C%20pekann%C3%B8tter%2C%20pistajsn%C3%B8tter%2C%20valn%C3%B8tter)%20for%20each%20unique%20product%20id.%20So%20I%20need%20to%20add%20four%20new%20rows%20where%20the%20Allergens%20column%20will%20have%20those%20four%20new%20values%20but%20the%20remaining%20columns%20can%20have%20the%20same%20value%20as%20those%20above.%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EFinally%2C%20I%20want%20to%20sort%20the%20allergen%20column%20so%20that%20all%20values%20with%20nuts%20(n%C3%B8tter)%20come%20in%20the%20end.%20That%20means%20the%20value%20pean%C3%B8tter%20(peanuts)%20should%20be%20moved%20to%20the%20bottom%20of%20the%20list.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EI%20have%20tried%20to%20do%20this%20manually%20but%20it%20takes%20too%20much%20time%20so%20I%20want%20an%20automatic%20way%20to%20this%20by%20example%20power%20query.%20I%20haven't%20used%20power%20query%20before%20but%20if%20there%20is%20any%20way%20of%20doing%20this%20in%20an%20automatic%20way%2C%20then%20I%20would%20really%20appreciate%20the%20help.%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EIn%20the%20attachment%2C%20I%26nbsp%3B%20have%20recorded%20a%20demo%20of%20how%20Im%20doing%20it%20today.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1818061%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Highlighted
Occasional Contributor

Hi everyone,

 

I have a huge dataset with information about different product id's. One of the columns has information about allergens and I want to add four new allergen values (Paranøtter, pekannøtter, pistajsnøtter, valnøtter) for each unique product id. So I need to add four new rows where the Allergens column will have those four new values but the remaining columns can have the same value as those above. 

Finally, I want to sort the allergen column so that all values ​​with nuts (nøtter) come in the end. That means the value peanøtter (peanuts) should be moved to the bottom of the list. 

 

I have tried to do this manually but it takes too much time so I want an automatic way to this by example power query. I haven't used power query before but if there is any way of doing this in an automatic way, then I would really appreciate the help. 

 

In the attachment, I  have recorded a demo of how Im doing it today.

 

 

0 Replies