Forum Discussion
Table.ReplaceValue list not replacing null data consistently
- 3 years ago
In this example, the nulls are not empty strings or actual blanks, they are text "null". However, replacing "null" with null did recreate your issue. Here's a simplified version of what you provided:
let Source = Table.FromRows( Json.Document( Binary.Decompress( Binary.FromText( "i45WckwpSy0qySzOzEtX0lEqTi5IAVJ5pTk5SrE60UoBiUUlealF+s75ecWlOSWJeSUK7qlAgcSSVJC6MBMF54zU5GyFoNTkzILM1LwSZM14jI4FAA==", BinaryEncoding.Base64 ), Compression.Deflate ) ), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [LeadSource = _t, Lead_Source_Detail__c = _t, #"Person Source" = _t] ), #"Replaced Value" = Table.ReplaceValue( Source, "null", null, Replacer.ReplaceValue, Table.ColumnNames(Source) ), #"Person Source Replace null" = Table.ReplaceValue( #"Replaced Value", null, each if [Person Source] = null and List.Contains({"Advertising"}, [LeadSource]) then "Digital Advertising" else if [Person Source] = null and Text.Contains([Lead_Source_Detail__c] = "conference") then "Event" else if [Person Source] = null then "none" else [Person Source], Replacer.ReplaceValue, {"Person Source"} ) in #"Person Source Replace null"The problem is with
Text.Contains([Lead_Source_Detail__c] = "conference")On its own, this throws the error "Expression.Error: 1 arguments were passed to a function which expects between 2 and 3".
I haven't dug into why just eats the error when included inside else if instead of returning an error for that row, but all that's needed to resolve it is to replace "=" with ",".
Text.Contains([Lead_Source_Detail__c], "conference")
Hello, could you filter it in the first step and the code would work, if it does not work you could share a screenshot of the code and the result?
- jfbonterra3 years agoFrequent Visitor
Here is the null data I'm seeing after applying the step (highlighted column and the end of the suntax which is also above in full).