Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now
Having trouble thinking through this pivot/unpivot question transform.
I have data like this:
| ID | Which fruits do you like? | How many do you have? | Which fruits do you like 2? | How many do you have 2? | Which fruits do you like 3? | How many do you have 2? |
| 101 | Apple | 4 | Plumb | 8 | Orange | 14 |
| 102 | Orange | 3 | Apple | 2 | Pear | 9 |
| 103 | Peach | 5 | Orange | 2 | Grapes | 11 |
| 104 | Grapes | 2 | Apple | 3 | Plumb | 12 |
I'm trying to get to data like this:
| 101 | Which Fruits | Apple | 4 |
| 102 | Which Fruits | Orange | 3 |
| 103 | Which Fruits | Peach | 5 |
| 104 | Which Fruits | Grape | 5 |
| 101 | Which 2 | Plumb | 8 |
| 102 | Which 2 | Apple | 2 |
| 103 | Which 2 | Orange | 2 |
| 104 | Which 2 | Apple | 3 |
| 101 | Which 3 | Orange | 14 |
| 102 | Which 3 | Pear | 9 |
| 103 | Which 3 | Grapes | 11 |
| 104 | Which 3 | Plumb | 12 |
And finally to this (which is simply conditionally changing the Which 2 and 3's to which... so I think that's not hard)
| 101 | Which Fruits | Apple | 4 |
| 102 | Which Fruits | Orange | 3 |
| 103 | Which Fruits | Peach | 5 |
| 104 | Which Fruits | Grape | 5 |
| 101 | Which Fruits | Plumb | 8 |
| 102 | Which Fruits | Apple | 2 |
| 103 | Which Fruits | Orange | 2 |
| 104 | Which Fruits | Apple | 3 |
| 101 | Which Fruits | Orange | 14 |
| 102 | Which Fruits | Pear | 9 |
| 103 | Which Fruits | Grapes | 11 |
| 104 | Which Fruits | Plumb | 12 |
Any ideas?
Thanks!
Sorry forgot the last part - add a new column to that table for which fruits:
Hi,
you could duplicate the table a couple of times and remove 2 of the which friuts and how many columns in each.
Rename all the columns to remove numbering and so they are the same in each table and then append them together, then just unpivot the which fruits column.
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
A great idea. Problem is I have about 30 groups of these with 10 each.. So might become quite cumbersome.
Ah okay, you could create a calculated table with DAX in the data view:
If I answered your question, please mark my post as solution, Appreciate your Kudos 👍
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
Check out the February 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 61 | |
| 59 | |
| 42 | |
| 18 | |
| 15 |
| User | Count |
|---|---|
| 109 | |
| 102 | |
| 39 | |
| 29 | |
| 29 |