locked
IF Function with more Conditions RRS feed

  • Question

  • Hello

    Firstly i want to apologize, if I make grammatical Mistakes, my english is not the best.

    So I'm new to Power Query and I have to do a Formula with the Power Query, where I have 2 Conditions.

    In the first Row, there are Numbers : "212" ; "211" ; "218"

    And in the second row i have to write a text for every number, so when in the first row there is a "212" in the second row there must be written "abc" (per example). And when in the first row is "211" there has to be "cba" and when there is "218" there has to be "bca".

    I hope you understand what I want, and someone can help me with the right formula.


    Wednesday, January 13, 2016 8:07 AM

Answers

  • You can transpose the table to be a single column with three rows, then define a new column with the code below:
    = if [Column1] = "212"
    then "abc"
    else if [Column1] = "211"
    then "cba"
    else if [Column1] = "218"
    then "bca"
    Then you can transpose back.

    GNet Group BI Consultant

    Wednesday, January 13, 2016 5:16 PM
  • Wouldn't it be simpler to create a table with the number in one column and the corresponding text in another column?
    Wednesday, January 13, 2016 5:41 PM

All replies

  • You can transpose the table to be a single column with three rows, then define a new column with the code below:
    = if [Column1] = "212"
    then "abc"
    else if [Column1] = "211"
    then "cba"
    else if [Column1] = "218"
    then "bca"
    Then you can transpose back.

    GNet Group BI Consultant

    Wednesday, January 13, 2016 5:16 PM
  • Wouldn't it be simpler to create a table with the number in one column and the corresponding text in another column?
    Wednesday, January 13, 2016 5:41 PM