Forum Discussion
Reshaping Economic Data in PowerBI
- 1 year ago
Welcome to Power BI!
First thing you need to do is unpivot your data. There are a few ways, but for this type of data where 2026 would bring a new column....
1. Select your Country and Metric columns (hold ctrl to select multiple columns) and under the Transform tab > (find arrow on) Unpivot columns > Unpivot Other Columnsdata should look like this
2. Select your metric column and pivot this column. A dialog box will ask you which column has your values and just select your newly created values column from the previous step.
3. Enjoy the new data structure!
Quick note: The reason you use the unpivot other columns as the first step is that your unpivot only cares that 'Country' and 'Metric' exist. It will unpivot every other column even if another year gets added. You COULD select all the year columns and ask it to unpivot those specifically but when a new year gets added you will need to come back in and adjust it.
Welcome to Power BI!
First thing you need to do is unpivot your data. There are a few ways, but for this type of data where 2026 would bring a new column....
1. Select your Country and Metric columns (hold ctrl to select multiple columns) and under the Transform tab > (find arrow on) Unpivot columns > Unpivot Other Columns
data should look like this
2. Select your metric column and pivot this column. A dialog box will ask you which column has your values and just select your newly created values column from the previous step.
3. Enjoy the new data structure!
Quick note: The reason you use the unpivot other columns as the first step is that your unpivot only cares that 'Country' and 'Metric' exist. It will unpivot every other column even if another year gets added. You COULD select all the year columns and ask it to unpivot those specifically but when a new year gets added you will need to come back in and adjust it.