Forum Discussion
Replace null(s) in a list
- 6 years ago
Hi!
The only replacement needed in your situation is {null, "NA"}, without quotes on null, and that's why your first code works and the second one doesn't.
Your function should work properly this way:
(others as list) =>
let
listA = List.ReplaceMatchingItems(others, {{null, "NA"}})
in
listA
I'm glad I could help you. See ya.
- 6 years ago
Hi Anonymous
Because in Power query, null means null value type, "null" mean a text field which its value is "null".
In your example, your data example show null value type, so the query with {{"null", "NA"}} doesn't work.
Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
HI mmarino,
It has a try-otherwise statement available and may it help you. Like: try Extracted Values[...] otherwise null.
But I think if you build a function to extract that list, you'll solve your problem:
Choose one of this lines and click on List to expand only that list. Then you can replace null values. When you have it done, duplicate your source and convert it to a function by adding "(var as <type>) =>" and make the first one use it.