Reputation: 1
I have a data set that is pulled together from different sources, but on one table. I need a formula that will help me evaluate and choose the correct column.
3 Text Columns
The columns could all have values in them or could all be null. I want to create a final column called Final_Code that follows this logic.
Test:
Upvotes: 0
Views: 22
Reputation: 953
You should do this transformation with Power Query, you can use the following M-code:
let
Source = YourTable, // Replace 'YourTable' with your actual table name
AddFinalCode = Table.AddColumn(Source, "Final_Code", each
if [4Ever_Code] <> null and Text.Trim([4Ever_Code]) <> "" then [4Ever_Code]
else if [Kit_Code] <> null and Text.Trim([Kit_Code]) <> "" then [Kit_Code]
else [USI],
type text
)
in AddFinalCode
Upvotes: 0