0

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

  1. USI
  2. 4Ever_Code
  3. Kit_Code

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:

  1. If 4EverB is not blank or null then supply that value for the row.
  2. If 4EverB is blank or null the check Kit_Code if it exists use that value for the row
  3. If both 4EverB is null or blank and Kit_code is null or blank, then the USI should be chosen for the row.

enter image description here

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Jan 22 at 4:05

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.