Forum Discussion
We cannot convert the value null to type Number
I'm telling you, the "or" operator doesn't not work nicely with comparing null values. The most efficient and error free way for you to write this is:
#"Replaced Value" = Table.ReplaceValue(ChangedType3,each _, each if Number.IsNaN([Sales history months]) then 24 else if [Sales history months] = null then 24
else [Sales history months],Replacer.ReplaceValue,{"Sales history months"}),
#"Replaced Value1" = Table.ReplaceValue(#"Replaced Value",null,24,Replacer.ReplaceValue,{"Sales history months"}),
#"Changed Type3" = Table.TransformColumnTypes(#"Replaced Value1",{{"Sales history months", Int64.Type}}),
#"Sorted Rows" = Table.Sort(#"Changed Type3",{{"Sales history months", Order.Ascending}}),
This will leave you with no errors to handle.
if/then/else if
works fine with = null. The "or" operator does not like = null.
I assure you--give this code a try, you'll see what I mean!
--Nate