Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

How to use if else function using power query?

Hi all,

 

I wanna get the output column, i cannot use unpivote function as the table already pivot for other column( the picture just sample of column). It can cause duplication if unpivote the table.

 

Then i tried to use if else function in power query but still cannot manage to do it.

Thank you for your help.

 

P/S: i need to get the output column using power query before 

 

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  Anonymous ,

     

    Here are the steps you can follow:

    1. Power Query  --  Add Column -- Custom Column.

    2. Enter the following code.

    if [Category] = "AA" then [Limit AA] else if [Category] = "BB" then [Limit BB] else [Limit CC]

    3. Result:

     

    Best Regards,

    Liu Yang

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

2 Replies

  • Anonymous , A new column

    if [Category] =  "AA" then [Limit AA]

    else if [Category] =  "BB" then [Limit BB]

    else if [Category] =  "CC" then [Limit CC]

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi  Anonymous ,

     

    Here are the steps you can follow:

    1. Power Query  --  Add Column -- Custom Column.

    2. Enter the following code.

    if [Category] = "AA" then [Limit AA] else if [Category] = "BB" then [Limit BB] else [Limit CC]

    3. Result:

     

    Best Regards,

    Liu Yang

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