Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

iferror in M Language

hi , 

 

i wanted to apply this excel formula to M language. 

 

Iferror (if (Non captive amount.amount <> 0, usd@planrate helpcell2, if( noncaptive amount.amount = 0 , usd@planrate helpcell1. usd@planrate help3 (NFC))), usd@planrate help3 (NFC))

 

how do i change it correctly? 

Thanks

  • Hey Anonymous ,

     

    you didn't close the bracket of the ifs.

    Close them and I think it should work.

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     
  • Hi, Anonymous ;

    The conditional format formula of M language is written as follows:

    if [Non Captive Amount.amount] <>null then [#"USD@planrate helpce112"]
    else if [Non Captive Amount.amount] =null then [#"USD@planrate helpce111"] 
    else null

    in addition, here it is recommended that the column name in power Query do not have #"".

    Or you could add conditional column in power query .

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

4 Replies

  • selimovd's avatar
    selimovd
    Most Valuable Professional

    Hey Anonymous ,

     

    you didn't close the bracket of the ifs.

    Close them and I think it should work.

     

    If you need any help please let me know.
    If I answered your question I would be happy if you could mark my post as a solution ✔️ and give it a thumbs up 👍
     
    Best regards
    Denis
     
    • Anonymous's avatar
      Anonymous
      Not applicable

      May i know why it will have this "function" here

      Supposely, all should be numbers or null. 

  • Anonymous's avatar
    Anonymous
    Not applicable

    Anonymous Parenthesis are unnecessary as is second 'each'.

  • v-yalanwu-msft's avatar
    v-yalanwu-msft
    Community Support

    Hi, Anonymous ;

    The conditional format formula of M language is written as follows:

    if [Non Captive Amount.amount] <>null then [#"USD@planrate helpce112"]
    else if [Non Captive Amount.amount] =null then [#"USD@planrate helpce111"] 
    else null

    in addition, here it is recommended that the column name in power Query do not have #"".

    Or you could add conditional column in power query .

    Best Regards,
    Community Support Team_ Yalan Wu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.