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
Unfortunatley this view is needed for the next step
Hi lennardheyder ,
So you also want the line 227 to show the price from Q1?
If not,pls provide some sample data in editable format with expected output.
Much appreciated.
Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
- lennardheyder5 years agoFrequent Visitor
Hey,
exactly, the formula should always to first value which is availble, so for 227 the price from Q1 ut could also be a later quater if no proce is available before. Thanks for your help!!