Forum Discussion
Number of Columns Increasing With Each Month
I think I have a pretty unique problem where for each line item there will be associated data in a month column. However each month, the dataset will update with a new column for the new month
Ex. - Month 1
| ID | 10/01/2021 |
| 1 | .37 |
| 2 | .84 |
Ex. - Month 2
| ID | 10/01/2021 | 11/01/2021 |
| 1 | .37 | .14 |
| 2 | .84 | .50 |
Question - is there a way to manage the increasing number of columns each month in PQ?
What I've tried - I tried a grouping on the ID, but this won't work in the new months.
Any Ideas?
Yes. Select the ID Column, then right-click and "Unpivot Other Columns"
Now you can have unlimited date columns and they will be in one column and your values in another. This is the proper way to build a table. The Unpivot feature is one of the best things about Power Query.
2 Replies
- edhansCommunity Champion
Yes. Select the ID Column, then right-click and "Unpivot Other Columns"
Now you can have unlimited date columns and they will be in one column and your values in another. This is the proper way to build a table. The Unpivot feature is one of the best things about Power Query. - v-jingzhangCommunity Support
Hi Anonymous
Have you tried edhans 's solution? It should work well. Let us know if you have any questions.
Best Regards,
Community Support Team _ Jing