Forum Discussion
Replacing Multiple Cell Values
- 2 years ago
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtIztrRUitWJVlIAk4amYMrUQM8QSRRCGuiBlMYCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Original = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Original", type number}}), #"Replaced Value" = Table.ReplaceValue(#"Changed Type",each [Original],each if [Original]=null then "No Rebate" else "Rebate",Replacer.ReplaceValue,{"Original"}) in #"Replaced Value"How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".
yes, Table.ReplaceValues() has a lot of interesting features, including that one.
Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot). Leave out anything not related to the issue.
If you are unsure how to do that please refer to https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Please show the expected outcome based on the sample data you provided.
If you want to get answers faster please refer to https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
- negbc2 years agoHelper II
Thanks, a sample is below. What the original column would be in my data set and then what I would like the column to look like after the transformation.
Original Transformed 2.399 Rebate No Rebate 15 Rebate 50.1 Rebate No Rebate No Rebate 0.99 Rebate