Forum Discussion
Anonymous
3 years agoNot applicable
Replacing nulls or empty strings doesn't always work - what am i doing wrong?
If i want to replace several values in one step including any nulls/empty strings my mcode seems to skip these nulls/empty strings. example: = Table.ReplaceValue(#"Previous Step", each [mycolu...
- Anonymous3 years ago
Hi Anonymous - I understand what you are trying to achieve but I am not a fan of Table.ReplaceValue. I prefer the Table.TransformColumns approach Check the last paragraph in Section 3.
The formula would look like this:
= Table.TransformColumns(#"Previous Step", { { "mycolumn", each if _ = "x" then "Yes" else if _ = "" then "Unknown" else if _ = null then "Unknown" else "No" , type text } } )
Anonymous
3 years agoNot applicable
Hi Anonymous - I understand what you are trying to achieve but I am not a fan of Table.ReplaceValue. I prefer the Table.TransformColumns approach Check the last paragraph in Section 3.
The formula would look like this:
= Table.TransformColumns(#"Previous Step",
{
{ "mycolumn", each
if _ = "x" then "Yes"
else if _ = "" then "Unknown"
else if _ = null then "Unknown"
else "No" , type text
}
}
)