This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hello.
I need some help with data modelling here! I have the table below -
| Buyer | Green Apple | Red Apple | Orange | Pineapple | Kiwi | Strawberry |
| James | 1 | 0 | 0 | 0 | 0 | 0 |
| James | 0 | 0 | 0 | 0 | 1 | 0 |
| Mary | 0 | 1 | 0 | 0 | 0 | 0 |
| Mary | 0 | 0 | 0 | 0 | 0 | 1 |
| Mary | 1 | 0 | 0 | 0 | 0 | 0 |
| John | 0 | 1 | 0 | 0 | 0 | 0 |
| John | 0 | 0 | 1 | 0 | 0 | 0 |
| John | 0 | 0 | 0 | 0 | 1 | 0 |
I would like to convert the table to what is shown below -
| Buyer | Green Apple | Red Apple | Orange | Pineapple | Kiwi | Strawberry |
| James | 1 | 0 | 0 | 0 | 1 | 0 |
| Mary | 1 | 1 | 0 | 0 | 0 | 1 |
| John | 0 | 1 | 1 | 0 | 1 | 0 |
Is there any quick way to get this done. Any help or advise would be grateful!
Thanks
JS
Solved! Go to Solution.
Yes, it can be done easily in Power Query:
(1) unpivot all the non-Buyer columns, so that you get a table with 3 columns: Buyer, Fruit, Qty
(2) group by both Buyer and Fruit columns, summing over Qty
(3) finally, pivot the Fruit and Qty columns
Yes, it can be done easily in Power Query:
(1) unpivot all the non-Buyer columns, so that you get a table with 3 columns: Buyer, Fruit, Qty
(2) group by both Buyer and Fruit columns, summing over Qty
(3) finally, pivot the Fruit and Qty columns
Thank you!!!! Worked perfectly!!!!
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 30 | |
| 28 | |
| 23 | |
| 19 | |
| 17 |
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 41 | |
| 21 | |
| 18 |