Forum Discussion

Alicia_Bucci's avatar
Alicia_Bucci
Copper Contributor
Dec 06, 2021
Solved

Power Query Multiple IF Conditions in Custom Column

Good morning,    I have a formula calculated in Excel that I am now looking to calculate in Power Query. I know I can only use column reference while writing IF statements in PQ. Can you please let...
  • SergeiBaklan's avatar
    Dec 06, 2021

    Alicia_Bucci 

    I'd simplify initial formula first, perhaps

    =IF( M5=N5,
         M5,
         IF( M5="BLANK1",
             IF( N5="BLANK2","Investigate", N5),
             IF( N5="BLANK2",
                 M5,
                 IF( M5 <> N5,
                     "300-Corporate", 
                     "ERROR" ) ) ) )
    

    with that

    =if [M] = [N]
     then [M]
     else
        if [M] = "BLANK1"
        then
            if [N] = "BLANK2" then "Investigate" else [N]
        else
            if [N] ="BLANK2"
            then [M]
            else
                if [M] <> [N]
                then "300-Corporate" 
                else  "ERROR"

     

Resources