Forum Discussion

OE_APerron's avatar
OE_APerron
New Member
6 years ago
Solved

IF Then else Statement with Text.Combine

Hello all,

 

I'm trying to figure out the proper syntax to combine to fields in a Custom column knowing that one of my field contains either number or text,

when I straight use Text.Combine all my records with number value return as error: Token comma expected error 

Can someone help with the proper syntax or potential solution?

The expected result is "[MFG Part No.], [Part Description]"

Thanks,

AP

  • OE_APerron in your expression, if and then show be lower case, M language is case sensitive.

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

2 Replies

  • OE_APerron in your expression, if and then show be lower case, M language is case sensitive.

     

    I would  Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos whoever helped to solve your problem. It is a token of appreciation!

    Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.

    • OE_APerron's avatar
      OE_APerron
      New Member

      Thanks for the tip!

       

      Afther a couple of iteration, below is the proper Syntax (corrections in red):

       

      if (Value.Is([#"MFG Part No."], Number.Type) = true) then Text.Combine({Text.From( [#"MFG Part No."]), [Part Description]}, ", ") else Text.Combine({[#"MFG Part No."], [Part Description]}, ", ")

       

      Thanks parry2k