Forum Discussion
Anonymous
4 years agoNot applicable
Power query conditional replacement
Hello and thanks in advance for the help. I'm trying to do some conditional replacement in power query and struggling with the syntax. I have a customer field which is like "customer name (12...
- 4 years ago
With kudos to Replace Values in Power Query - Ultimate Guide - BI Gorilla
and (originally)
let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wci4tLsnPTS0ygAFDJR0l/9KSnPz8bCArODWvOLMksyxVoSS1okQhI7UolSTRWB0cVrhWJKfm0NKC8My8lPzyYlpaEZBfnlqk4JRJSztGo2JQRIUR7aPCiNZRYUT7qDAajYrBEhXGdIgKY9pHhTGto8J4NCpGo2I0KoZ+VMQCAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"CustomerName(sensitiveData)" = _t, #"Product(OpenData)" = _t, SensitiveDataField1 = _t, SensitiveDataField2 = _t, SensitiveDataField3 = _t]), #"Replaced Value" = Table.ReplaceValue(Source,each [#"CustomerName(sensitiveData)"]<>"Customer0000000001", "Redacted", (x,y,z)=> if y then z else x ,{"SensitiveDataField1","SensitiveDataField2","SensitiveDataField3"}), #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",each [#"CustomerName(sensitiveData)"]<>"Customer0000000001", each "Redacted" & Text.End([#"CustomerName(sensitiveData)"],10), (x,y,z)=> if y then z else x ,{"CustomerName(sensitiveData)"}) in #"Replaced Value1"
lbendlin
Super User
4 years agoAnonymous Where did "{"Field 1", "Field 2", "Field 3"}" come from?
Please provide sanitized sample data in usable format (not as a picture - inserting it into a table would be good) and show the expected outcome.