Forum Discussion

ritanoori's avatar
ritanoori
Icon for Resolver I rankResolver I
5 years ago
Solved

Need help in a custom column

Hello everyone 

 

I'm trying to create two custom columns in power query and I'm trying to merge the two steps into one can you help pls. 

 

First col: 

SPN= if(
[System]) = "IC" then [GltDescription] else

if([IcItem]) is null then [Item] else

if([Item]) is null then [IcItem] else [Item]

 

Second col: 

SPN2= if(
Text.Contains[SPN]) ="AUTO" then "" else [SPN])

 

How can I put the two in one custom col please. 

Thanks 

Rita

 

  • Hi, ritanoori 

     

    You can try like this:

    let SPN = if(
    [System]) = "IC" then [GltDescription] else
    if([IcItem]) is null then [Item] else
    if([Item]) is null then [IcItem] else [Item]
    in if
    Text.Contains(SPN,"AUTO") then "" else SPN

    Best Regards

    Janey Guo

     

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

2 Replies

  • ritanoori , Actually then depend on where you want it. because they are mutually exclusive.

     

    What is the final output you want.

  • v-janeyg-msft's avatar
    v-janeyg-msft
    Icon for Community Support rankCommunity Support

    Hi, ritanoori 

     

    You can try like this:

    let SPN = if(
    [System]) = "IC" then [GltDescription] else
    if([IcItem]) is null then [Item] else
    if([Item]) is null then [IcItem] else [Item]
    in if
    Text.Contains(SPN,"AUTO") then "" else SPN

    Best Regards

    Janey Guo

     

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