Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
HxH
Helper II
Helper II

Creating "folders" for power query steps

Hi everyone, 

I'm currently doing a lot of data cleaning in Power Query. I have a column where the operators of my company manually input data and therefore I have to clean it. Is there a way to put the steps of PQ in some sort of folder/group that could help me to better identify substeps I did while cleaning data? 

For example I do a lot of replace values to correct the data, and it would be much easier to navigate my PQ steps if I had something like "value replacings for product A", "value replacings for product B", with all the value replacements I did for the specific product inside, because I have like 70 products and I have to do 6-7 replacement for each one, and the PQ steps list becomes a nightmare. 

 

EDIT: if there's a way to do the "replace value" operation with multiple value entries, that would also solve my problem

1 ACCEPTED SOLUTION

Hi

if you're actually replacing the full strings, then its super easy with a translattion table. Just keep your translations in that table and use 1 or 2 query steps to do all replacements in one go.

 

You can also try the fuzzy-merge (see attached file) - maybe that works for you. That just requires a list of your desired target values - so no need even to type in all translations manually.

 

If you need to replace sub-strings, please come back.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

4 REPLIES 4
ImkeF
Super User
Super User

Hi @HxH ,

it certainly sounds as if you're doing this wrong. 

If you could give some more details about your task, I could suggest an easier way. 

Just to give you an idea of how to use a translation table: https://www.thebiccountant.com/2016/05/22/multiple-replacements-in-power-bi-and-power-query/

That could be applied with conditions or on multiple columns as well.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Hi @ImkeF 

yes I'm probably doing this in a super inefficient way. I have a column with various models of some product. The point is that for reason I'm not going to dive into the operators manually type in this model, so I get multiple different entries (one with upper case, one with lower case, one has only half the word, various typos ecc) for each distinct model. I want to replace all this with a single value in order to have a clean "Model" column I can use to perform calculations. I suppose there is some PQ code that could help me do this very easily but I'm no expert so I was manually using the "replace values" button for each wrong entry 

Example: 

MODEL COLUMN                                                                       MODEL COLUMN 

Apple                                                                                          Apple

Aple                                                                                            Apple

apple                                                 should become -->          Apple

Banana                                                                                       Banana

bananas                                                                                      Banana






Hi

if you're actually replacing the full strings, then its super easy with a translattion table. Just keep your translations in that table and use 1 or 2 query steps to do all replacements in one go.

 

You can also try the fuzzy-merge (see attached file) - maybe that works for you. That just requires a list of your desired target values - so no need even to type in all translations manually.

 

If you need to replace sub-strings, please come back.

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Stachu
Community Champion
Community Champion

I'm not sure if this is what you're looking for, but if you have query which has a lot of steps then you can split it in multiple queries with referencing and group these queries in the folders, like here

Capture.PNG

ModifedA was created by pressing RMB on ReplacedValuesA and choosing Reference. Also ReplacedValuesA is not loaded to the model - it's only executed as part of ModifedA refresh

 

Otherwise you can start renaming the steps in the list, having your own description makes the steps much easier to identify



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors