In main query table, there are a number of columns with null that need to be replaced with the name of the column. It can be done one by one, but I am trying to create one step that handles this.
So far I have this M code (2 of the column names have been placed as an example but the list of columns is longer):
I would like the x in List_nullCategories{x} to start off as a 0 and be replaced with the count of each list item until the end of the list.
Is there a way to wrap the whole Table.ReplaceValue function inside another function that loops through the list and changes the value of x? If there is a better way to do this iteration, then I am open to that as well.
So far I have this M code (2 of the column names have been placed as an example but the list of columns is longer):
Power Query:
List_nullCategories =
{"Age", "Race"}
FillDown_Categories =
Table.ReplaceValue(Source,
each [Age] = null,
List_nullCategories{x},
(currentValue, condition, newValue) =>
if condition then newValue
else currentValue,
List_nullCategories
)
in
FillDown_Categories
I would like the x in List_nullCategories{x} to start off as a 0 and be replaced with the count of each list item until the end of the list.
Is there a way to wrap the whole Table.ReplaceValue function inside another function that loops through the list and changes the value of x? If there is a better way to do this iteration, then I am open to that as well.