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.
Me again,
I am combining steps to clean up my Query Editor. E.g. Renaming columns all in one step rather than all over the shop.
I want to combine Table.ReplaceValue steps but it doesn't seem to want to. I assume you cannot do this for some reason, but if you know how then please let me know.
I tried copying one of my replace values onto the end of another, separated by a comma with the parenthesis wrapping all of it.
This didn't work.
Hi @Anonymous,
Could you please mark the proper answers as solutions?
Best Regards,
Dale
Hi @Anonymous,
I would suggest you provide a dummy pbix file. We can give you a solution with details in the file. If you'd like to share a file, you can upload it to the cloud drive like OneDrive, GoogleDrive, then share the download link here. Please don't share sensitive data here.
Best Regards,
Dale
Hi Dale,
Sorry for the delay in response.
I cannot attach the dataset but I have screenshots of what i'm talking about.
So I have 20 Replaced Value steps.
I had about the same number of steps for Renamed Columns and Changed Type, and I was able to combine these steps into one single step each using M-Query in the formula bar by using curly brackets and coma separators.
I want to do the same for the Replaced Value steps. However applying the same logic as I did for the Renamed Columns steps, does not work for Replaced Value.
So to summarise, I am wondering if it is possible to combine 'Replaced Value' Applied Steps using M-Query in the formula bar.
Hi @Anonymous,
@PattemManohar's solution works. Please check out the demo in the attachment.
Best Regards,
Dale
@Anonymous It is possible, Please try this...
Renaming Mutliple columns in single step:
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"Product", "Product1"}, {"Tank", "Tank1"}, {"Inventor", "Inventor1"}}),
Mutliple Replace values in single step:
#"AllReplace" = [#"DIESEL" = "DIESEL1",#"REG" = "REG1"], #"Replaced Value" = Table.TransformColumns(#"Renamed Columns",{{"Product1",each Record.FieldOrDefault(AllReplace,_,_)}})
Proud to be a PBI Community Champion
Greetings @PattemManohar
is there a way to read #"DIESEL" and "DIESEL1" from columns of another table?
so that there is a replacements table?
Hi there Pattem,
I can't figure this out.
In the step i've pasted below I am is replacing </font> with blank. (some crazy formatting was pulled into my BI report)
My next replace would be for example <font> with blank
After that I want to replace <font face> with blank
In total, I have 20 replaced values. I want them all in one step. Below is the first step, if you can show me what to type instead of what is below, I can probably follow. I'm just getting used to Power BI and Query Editor still!
= Table.ReplaceValue(#"Replaced Value","</font>","",Replacer.ReplaceText,{"Claim ID/Invoice_x00"})
@Anonymous Please provide some sample data so that I can provide you the exact steps as per that. Meanwhile, I'll make it clear about the steps I've provided
#"AllReplace" = [#"DIESEL" = "DIESEL1",#"REG" = "REG1"], #"Replaced Value" = Table.TransformColumns(#"Renamed Columns",{{"Product1",each Record.FieldOrDefault(AllReplace,_,_)}})
In Advanced Editor, I've added a #"AllReplace" which contains a list of old and new values (DIESEL is old value and DIESEL1 is new value to get replaced. Similarly, REG is an old value and REG1 will be a new value)
Then add an another step, where I've used this list. You need to use "Table.TransformColumns" if you want to do all search and replace in single step but not "Table.ReplaceValue"
Proud to be a PBI Community Champion
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
100 | |
83 | |
76 | |
65 |
User | Count |
---|---|
120 | |
108 | |
98 | |
83 | |
77 |