fbpx

How to use Unpivot to clean data instantly

This is a log of what I explore and learn.

Power Query – Unpivot Other Columns

Earlier I wrote an article about the Unpivot feature of Power Query:
Crosstab data consolidation using Power Query

The concept is simple but powerful. Consider the data… It is already imported into Power Query. This is a cross-tab. I want simple tabular data containing three columns: Country, Year and Consumption.

image

This is done by selecting all the year columns and then right click to choose the UNPIVOT option. Recently, Power Query team updated few features. Unpivot was one of them.

The data I have is from 1965 to 2012. Imaging the trouble you have to take to just select so many columns. Therefore, the Power Query team smartly added a new feature called Unpivot Other Columns. Note that this option is available in the drop down menu on the Transform ribbon. It is NOT available in the right click menu (context menu).

Power Query unpivot other columns

Now what do I need to do? Just select the First column and choose this option. Job done. Now we got data like this. (I have renamed the first column as country now).

image

Creating this information into a 3D map

Just to complete this topic, I will show you the output of this data shown using Power Map. In the upcoming articles, I will discuss Power Map in detail.

Data visualization 3D map

***

Queries | Comments | Suggestions | Wish list