Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Each if clauses - Text comparisons

Unfortunately, I only have a rudimentary knowledge of PowerQuery and would need some assistance.

 

I would like to create a user-defined column in which text entries from another column are evaluated.

 

= Table.AddColumn(#"Umbenannte Spalten", "Vers_act", each if Text.Contains([BricsCAD Version], "Pro") then "Pro Version" else
each if Text.Contains([BricsCAD Version], "V19") then "Lite Version" else
each if Text.Contains([BricsCAD Version], "V20") then "Lite Version" else null)

 

Expected result -> column with entries: Pro Version, Pro Version, Lite Version, Lite Version....

 

Generated result:

 

Can you provide a small explanation, why the other statements aren´t recognized / a function gets returned instead of a Text /String?

 

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi Anonymous ,

     

    I reproduced your issue.

    Please remove "each" and it will be correct.

     

                                                                                                                                                             

    Best Regards,

    Stephen Tao

     

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

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    I reproduced your issue.

    Please remove "each" and it will be correct.

     

                                                                                                                                                             

    Best Regards,

    Stephen Tao

     

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

  • Anonymous's avatar
    Anonymous
    Not applicable

    Thank you very much for your help, really appreciate that 🙂