Forum Discussion
Dynamic column choice if null for index needed
- Anonymous5 years ago
given the limited information you provide it is not possible to provide a suitable answer for general cases. I give you an idea of what can be done, based on what I understand for what you ask. The answer can be improved, but you must also collaborate, providing more precise information on the structure of your data and loading tables that can be copied: one the starting one and the other desired.
- Anonymous5 years ago
You can use the null coalescing operator:
Table.AddColumn(TableName, "Index", each [Column1]??[Column2]??[Column3]??[Column4]??"Default Value")
Which is if Column1 =null then Column2 unless Column 2 is null then Column3 unless Column3 is null then Column4 unless Column4 is null then use Default Value.
--Nate
You can use the null coalescing operator:
Table.AddColumn(TableName, "Index", each [Column1]??[Column2]??[Column3]??[Column4]??"Default Value")
Which is if Column1 =null then Column2 unless Column 2 is null then Column3 unless Column3 is null then Column4 unless Column4 is null then use Default Value.
--Nate