Skip to content
Frederic Descoust | 26 November 2024

Effortlessly unpivot data with Excel Power Query

Effortlessly unpivot data with Excel Power Query
Effortlessly unpivot data with Excel Power Query
2:51

When our customer came to me asking how we could load their historical General Leder (GL) data for the past four years, I knew I was in for a treat. They sent me an Excel file that was an extract of their current ERP system. The file was essentially a trial balance with 47 accounting periods presented in the columns. To make things more interesting, the file also had a sheet per Cost Center, each representing one of their stores or departments; 72 in total. These Cost Centers were defined as Global Dimension 1 during our implementation cycle. Here is what the data looked like:

blog-in-excel-power-query-1

My task was to take this raw data and transform it so that we could use it to create the General Journal entries. My tool of choice for this kind of work is Excel Power Query, which allows you to import or connect to external data and shape it to meet your needs.

No matter what kind of retailer you are, if you’re struggling to migrate a large amount of historical data, you may be able to use these steps to solve your problems. Here’s how:

1. Create the query to prepare for data transformation

Excel Power Pivot provides a powerful tool for efficiently transforming data. With just a few clicks, I created a query to combine all tabs into a single dataset. I opened a new Excel sheet and selected the file provided by my customer as the source data.

blog-in-excel-power-query-2

I’m now presented with the navigator where I need to select the main folder and click on “Transform Data.”

blog-in-excel-power-query-3

Now I have my Query where I can remove the columns I don’t need. First, I can select those columns and use the “Remove Columns” function in the toolbar.

blog-in-excel-power-query-4

Next, I must expand the data so that all my accounting periods and amounts are populated in the dataset and ready for the next transformation. 

I need to select the “Data” column and click on the icon to the right, making sure all my columns are selected before clicking “OK.” 

blog-in-excel-power-query-5

I can then promote my first row as headers.

blog-in-excel-power-query-6

2. Unpivot the columns

Now that my dataset has been defined, it’s time to unpivot the columns to get a new data set that I can use to create General Journal entries with. For this step, I need to select all the columns I want to unpivot then select the “unpivot columns” function in the “Transform” menu.

blog-in-excel-power-query-7

My columns have now been unpivoted!

blog-in-excel-power-query-8

3. Load the data into Excel

The last step is to simply load the data into Excel! All I need to do is to select the “Close & Load” function in the “Home” menu.

blog-in-excel-power-query-9

So, now I have a dataset that can be used easily as the source to create the General Journal entries and post to the General Ledger!

I want to point out that this dataset had just over 100,000 entries and it only took minutes for me to get from the source file to this dataset that I can now use.

blog-in-excel-power-query-10

 

Quit wasting time and losing business due to the wrong technology
Featured eBook

Quit wasting time and losing business due to the wrong technology

Get ahead of the curve and redefine your retail operations. Download our whitepaper to see how modular unified software can transform your business.
Download the eBook now