Forum Discussion
Turning duplicates rows into additional columns for distinct rows
I have seen a number of examples on here using 2 columns but they don't seem to work for me. I have a datasource that has a list of product brand, part number, product name, images that can contain duplicate product numbers for multiple images and I would like to have the duplicate images set to additional columns for distinct product numbers:
Brand A | 0001 | Widget 1| image1.jpg
Brand A | 0001 | Widget 1| image2.jpg
Brand A | 0002 | Widget 2| image1.jpg
Brand B | 0003 | Widget 3| image3.jpg
Brand B | 0003 | Widget 3| image4.jpg
I would like to have something like:
Brand A | 0001 | Widget 1 | image1.jpg | image2.jpg
Brand A | 0002 | Widget 2| image1.jpg | null
Brand B | 0003 | Widget 3| image3.jpg | image4.jpg
I tried the groupby part number (which is a distinct value) , creating a new column with the other column, and then expanding them, as I have seen in another answer, but it didn't seem to work as well with multiple columns as it did with just 2
Thanks!
Hi wkolcz ,
I would group them and add a nested index to the grouped values: NestedIndex in PowerBI - YouTube
Then pivot on that column so that they become the new column names.
2 Replies
- ImkeFCommunity Champion
Hi wkolcz ,
I would group them and add a nested index to the grouped values: NestedIndex in PowerBI - YouTube
Then pivot on that column so that they become the new column names.- wkolczFrequent Visitor
Thank you for the answer! It worked like a charm. Only issue I had was I forgot to click advanced when pivoting and selecting Don't Aggregate which makes a world of difference lol.