Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Conditional column: show original value instead of else null

I want a column to show its original values that are not conditioned instead of "else null".

 

I have made a conditional column on Power Query with employer names. My goal is to categorize and combine different employers under one name, e.g. if employer name is "MICROSOFT" then it should be categorized under "Microsoft".  The command works but it shows all not-categorized as null because the DAX is like this: else if Text.Contains([employer], "ABB") then "ABB" else null)

 

However, I have thousands of employer names and I am correcting the names of only the most prevalent ones and I would like the column to show the original values (all employer names) instead of null.

 

What should I write instead of else null? Thank you very much!

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi,

     

    You can insert a new step like this

     

     

    = Table.AddColumn(#"Renamed Columns", "Custom",
    each if [employer] = "ABB" then "ABB"
    else if [employer] = "MICROSOFT" then "Microsoft" else [employer])

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best regards ğŸ™‚

     

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi,

     

    You can insert a new step like this

     

     

    = Table.AddColumn(#"Renamed Columns", "Custom",
    each if [employer] = "ABB" then "ABB"
    else if [employer] = "MICROSOFT" then "Microsoft" else [employer])

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

    Best regards ğŸ™‚

     

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    The result was so simple but still I couldn't figure it out, thanks a lot!