简体   繁体   中英

Formatting of Data before input into Power BI

I have been struggling and racking in brain trying to take a set of sales data and easily manipulate it so that is can be read by Power BI and easily managed and manoeuvred around within the powerful program but I keep getting stuck. can someone help, please.See image here below from which I receive my data. the SKU and descriptions are all in their own column. from there we have multiple stores in which we sell these products. they are listed in their columns and split by SOH (stock on hand), Sales (stock qty sold) and NET (value sold). Please, can you think of a way to manoeuvre this data in a way that power BI will understand it?

Exccel Sales Sheet example

From what I see, your initial issue is that your table does not start in cell A1. Power BI begins reading data in the top left corner of the worksheet, so you should delete the first row (the "leading row") of your worksheet so that it can detect where the table begins.

This guide provides instructions and a video on best practices for preparing Excel data for Power BI: https://docs.microsoft.com/en-us/power-bi/service-excel-workbook-files

If you will consistently use a data file with a leading row (one with a title or other information that is not part of the table), there is a way to get Power BI to dynamically read data off other lines in the file. This guide walks you through how to set this up: https://powerpivotpro.com/2018/02/power-query-magic-dynamically-remove-leading-rows-columns/

We can take advantage of Power Query's features to quickly transform this to a usable dataset. The goal will be to move that vendor information as row data instead of column data, leaving SOH/QtySold/NetInc as three general columns. We can use Unpivot and Pivot to get it done.

1) Get rid of that first row. In the 'Home' ribbon, find and click 'Remove Rows' and select 'Remove Top Rows.' You'll get a dialog box and you can remove the top 1 row.

2) Promote those headers. Also on the home ribbon, find the 'Transform ' button group and click 'Use first row as headers' I made a mock dataset that imitates your data but isn't exactly the same.

在此处输入图片说明

3) Ok, we're going to get crazy and to a major unpivot of your data. Switch to the 'Transform' ribbon. Then, select the column header "SOH Vendor 1", scroll to your last column, hold shift, and click the header on that last vendor column. This will select all those columns in between.

4) With all the vendor columns selected, click 'Unpivot Columns' from the transform ribbon. It's in the 'Any Column' button group. All those columns get transformed into just two columns, and your table gets a whole bunch more rows.

在此处输入图片说明

5) Select the 'Attribute' column -- it's full of what used to be column header names. From the Transform ribbon, choose 'Split Column' and in the popup menu, specify 'By Delimiter'. In the dialog box, create a custom delimiter and use the string 'Vendor' as your delimiter. Click OK

在此处输入图片说明

6) your Attribute column get's split into to columns. One will be full of SOH, Qty Sold, and Net Inc. The other will be filled with vendor id codes. Rename that column to 'Vendor'.

在此处输入图片说明

7) If 'value' isn't the rightmost column, Reorder the columns so that it is. Highlight the Attribute - Copy.1 column (that's probably the name, but the column is the one that has SOH/QtySold/NetInc values, if it got named something else.

8) click on 'pivot column' and select 'Value' as the value column.

在此处输入图片说明

Presto!

You now have a table whose key information is SKU, Date, and Vendor (your table will have description and another date too). Each one of these has three facts in columns - SOH, Qty, and NetInc. You should be ready to go make awesome stuff!

Good luck, Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM