Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
Hi,
I am trying to replace NaN values in my table with following M code
#"remove_nan" = Table.TransformColumnNames(#"Rounded Off2",{{"q_to_p", each if Number.IsNaN(_) then 0 else _,type number}})
But when I hit enter, I get Expression.Error: We cannot convert a value of type List to type Function.
Kindly suggest how I can fix this?
Solved! Go to Solution.
you may use the function of Table.TransformColumns, instead of Table.TransformColumnNames
if you want to remove the value from columns regardless of column names, can try this code
=Table.TransformColumns(PreviousStepName,{},each if _ is number and Number.IsNaN(_) then 0 else _)
you may use the function of Table.TransformColumns, instead of Table.TransformColumnNames
Daniel, Thank you. It worked.
One added question, if I have to add another seperate line of code which removes "Infinity" from the coloums, how should I do that?
if you want to remove the value from columns regardless of column names, can try this code
=Table.TransformColumns(PreviousStepName,{},each if _ is number and Number.IsNaN(_) then 0 else _)
Daniel, Thanks much. Really appreciate your help. 🙂
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 8 | |
| 7 | |
| 6 | |
| 5 | |
| 3 |