Forum Discussion
Row that should be a column
I have the following data:
| Country | Customer |
| USA | Apple |
| Days of supply | 30 |
The problem is that Days of Supply should be a column
| Country | Customer | Days of Supply |
| USA | Apple | 30 |
So far I am not able to do it with Power Query
Any ideas?
2 Replies
- vicky_
Super User
I don't think that can be fixed in Power Query. You will need to fix it in at the source.
- mahenkj2
Solution Sage
Hi PowerBITestingG ,
It depends on what additional columns you may have and remaining data of these 2 columns. Incase you have a key column (Primary or ID column), then below can possibly be done:
1. Connect main table in PQ.
2. Duplicate it.
3. Filter main table for not having 'Days of supply'
4. Filer second table for having 'Days of supply'.
5. Unpivot second table for Country and customer columns and then promote first row as header
6. Now second table have ID column as well as 'Days of supply' column.
7. Now relate or merge both tables with ID column
The above is a possible approach. I could test on sample data you provided, but dont share here PQ code, reason much may depend on remaining data of your table.
Hope it helps!