Forum

Data transformation
 
Notifications
Clear all

Data transformation

5 Posts
3 Users
0 Reactions
120 Views
(@davkla)
Posts: 2
New Member
Topic starter
 

I have hard time figuring out how to transform data from a spreadsheet into useful format.

Please see the attached example of the data and what result should look like.

Please advise, I really enjoy your videos, but could not figure out this one.

 
Posted : 29/01/2021 3:09 pm
(@mynda)
Posts: 4761
Member Admin
 

Hi David,

Welcome to our forum! I'm not surprised you're having trouble with this data. The row labels are all stuffed into a single cell while the actual values are in individual cells.

In the attached file I cleaned the row labels and values in separate queries and then merged them back together.

Note: your source file is a .xls, but you must save the file as a .xlsx for Power Query to work with the data properly.

Mynda

 
Posted : 30/01/2021 12:02 am
(@davkla)
Posts: 2
New Member
Topic starter
 

Mynda, thank you so much! It's kind of complicated to follow all your steps.

Is there a way to save them and apply to a new file?

 
Posted : 02/02/2021 4:56 pm
(@mynda)
Posts: 4761
Member Admin
 

You can copy the M code/query by selecting the query in the 'queries and connections' pane in Excel, then CTRL+C to copy it. This will copy the M code of the query. Then you can go to your new file and create a blank query. In the Power Query window open the Advanced Editor and CTRL+V to paste.

You'll need to do this for each query and you'll need to make sure the source data is formatted in an Excel Table called 'Table1' and that it has the exact same number of columns as my file, or change the query accordingly.

Mynda

 
Posted : 02/02/2021 10:35 pm
(@janbednarik)
Posts: 1
New Member
 

Dear Mynda and David,

I have been going through the file Mynda created as of my learning process to see what steps were taken to transform data. It is really great, great stuff (and easy one, if you know how to do it :)))). However, I found out a small mistake in Mynda's final file, as she forgot to filter out few lines from David's file. It is the year "2021" and the date "1/1/2021" that are between "Customer 4" and "Customer 5". It got into the final results in Mynda's file as the first and second cell in "Customer 5" as 2021 and null cell.

David, what makes me puzzled is that in the original file of yours, there is a mistake in "Totals" at the bottom: in the sum of "Value(Net)/msf" and
the sum of "Ton/msf", they are not correct. You can check for yourself.

I am enclosing my final file for your check.

Best Regards,

Jan

 
Posted : 19/02/2021 3:39 pm
Share: