Forum Discussion

kkarol's avatar
kkarol
Frequent Visitor
1 year ago
Solved

two different data types in one if

Hi I have two columns one numeric [number] and one text [name] and i want to make an if statement with them each if ([name] = "AANNAA") and ([number]> 140) then "Yes" else "No" it does not work, i...
  • AlienSx's avatar
    1 year ago

    it works 

    let
        my_table = #table(type table [name = text, number = number], {{"BBB", 150}, {"AANNAA", 145}, {"AANNAA", 135}}), 
        it_works = Table.AddColumn(my_table, "if_statement", each if ([name] = "AANNAA") and ([number]> 140) then "Yes" else "No")
    in
        it_works

     

     

  • PwerQueryKees's avatar
    1 year ago

    The if statement you show is fine.
    What is the error you get and in what context do you use the if?

    Please share your code and a screenshot of the error message.

    My guess: The if returns a text, but the destination of that result does not accept text...