Forum Discussion

VoltesDev's avatar
VoltesDev
Helper V
6 years ago
Solved

How to Creata a custom column with IF and LEFT function

Hi all,

tried to create new Custom column like this :

 

IF([SalesOrderOriginCode] = "PHONE", "PHONE",
         IF(Text.Start([InvoiceAddressCity],1)= "A", "LOCAL","EXPORT")
)

 

No syntax error, but after press ok, it says The name IF wasn't recognized. What's wrong ?

 

Thanks

  • VoltesDev you didn't even copy my formula,  please read the syntax. IF in lower case. Keep in mind M language is case sensitive, FYI

     

    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.

6 Replies

  • VoltesDev seems like you are adding this in Powe Query

     

    if [SalesOrderOriginCode] = "PHONE" then  "PHONE" else
             if Text.Start([InvoiceAddressCity],1)= "A" then "LOCAL" else "EXPORT"
    

     

    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.

     

     

    • VoltesDev's avatar
      VoltesDev
      Helper V

      Hi,

       

      There is a red wave line at the first "then" and there is an error saying "Token Eof expected.

      Thanks