There are multiple ways to deal with this sort of thing.
If statement as Bo_Ry demonstrated.
try ... otherwise statement.
= Table.TransformColumns(#"Filtered Rows", {"departmentNumber", each try Text.Combine(List.Transform(_, Text.From), ",") otherwise null, type text})
Convert null into single item list before processing.
etc.
Edit: Which method to use, will largely depend on your data and processing need. List.Transform will throw error, when you are trying to transform non-list object. By using try... otherwise, it will handle all error cases. However, if you want to make sure only null is treated in this manner, it is better to use if statement to explicitly treat null values or apply type conversion before transformation. As try... otherwise will apply uniform error handling on all errors regardless of what caused the error.
Bookmarks