Forum

Cleaning Data in Po...
 
Notifications
Clear all

Cleaning Data in Power Query

9 Posts
3 Users
0 Reactions
251 Views
(@sunbirdaz)
Posts: 5
Active Member
Topic starter
 

This is what I am trying to do:
1. Delete rows where the Account column does not contain data with a colon ":"
2. In the Account column the Account name needs to be moved to a new column
so that the account name and the transaction date are not in the same column.
3. Copy down the Account names in the new column

This is all I am trying to do but I cannot figure out how.

There are 4 columns: Account Description Memo Amount
and 823 rows. Each row represents a different transaction for that account.
Each account will have varying number of entries and the number of accounts can
vary from month to month.

If I can get this working I am hoping I just do a Refresh for each succeeding month.
Hopefully you can give me some sense of direction on how I should proceed.

Example .xlsx file attached.

 
Posted : 13/09/2024 7:31 pm
Philip Treacy
(@philipt)
Posts: 1629
Member Admin
 

Hi Dale,

No file attached.  Click Start Upload after selecting the file.

Phil

 
Posted : 13/09/2024 8:35 pm
(@sunbirdaz)
Posts: 5
Active Member
Topic starter
 

Example Excel file attached.

 
Posted : 14/09/2024 9:47 am
Riny van Eekelen
(@riny)
Posts: 1185
Member Moderator
 

Not sure I got it right, but looking at the Expense Data, the attached file contains a query that I would want to create before analysing the data. If this is not what you had in mind, please clarify the end result you expect.

 
Posted : 14/09/2024 10:33 am
(@sunbirdaz)
Posts: 5
Active Member
Topic starter
 

Oh my gosh Riny! That is exactly what I want. And to think you solved my problem in just four steps. That is so great! I will study your solution so that I can apply it to other problems I will run across. 

I was a bit taken back when I saw the date on your post. Then I noticed that you are in Sweden. 

Thanks again.  Dale

 
Posted : 14/09/2024 6:00 pm
(@sunbirdaz)
Posts: 5
Active Member
Topic starter
 

Hi, I have another request regarding your solution to my problem. Your M code solution works very well but it would take me years to acquire the knowledge to be able to write M code to solve similar problems. My request is can the commands on the Power Query ribbon be used to arrive at a similar solution instead of writing M code? I will start another Post if you feel that that is appropriate.

Thanks.  Dale

 
Posted : 15/09/2024 8:38 pm
Riny van Eekelen
(@riny)
Posts: 1185
Member Moderator
 

I was actually going on auto-pilot here, doing what I always do without much further thought about alternative solutions.

The attached file now includes a "click-in-the-ribbon-only" solution, but it requires some extra steps.

In stead of using Add Custom column, I now used Add Conditional column. It allows you to build the if-then-else code by clicking in boxes. And as you see, it will produce the same M-code for you. However, my initial query required the try ...... otherwise part because I hadn't cleaned up the Date column first.

Would this work for you?

 
Posted : 16/09/2024 1:39 am
(@sunbirdaz)
Posts: 5
Active Member
Topic starter
 

Hi Riny, thank you. It is exactly what I was looking for. I will review it some more and study your v2 solution. I know I will learn much and be able to apply it to my future projects. I am an Excel junky having used spreadsheets and VBA for a few years. It's just been this last year that I have started exploring Power Query and Pivot Tables. I watch all the myOnlineTrainingHub YouTube videos on Excel that I can find. They are very helpful. Thank you again for being so willing to help. It is truly appreciated.

Dale

 
Posted : 16/09/2024 10:55 am
Riny van Eekelen
(@riny)
Posts: 1185
Member Moderator
 

Glad I could help. Keep learning!!

 
Posted : 16/09/2024 11:11 am
Share: