Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

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 help...

 

how do i change it correctly? 

Thanksusd@plan.PNG

2 ACCEPTED SOLUTIONS
selimovd
Super User
Super User

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
 

View solution in original post

v-yalanwu-msft
Community Support
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

vyalanwumsft_0-1634203726406.png

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

vyalanwumsft_1-1634203792859.png

Or you could add conditional column in power query .

vyalanwumsft_2-1634203919985.png

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.

View solution in original post

4 REPLIES 4
v-yalanwu-msft
Community Support
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

vyalanwumsft_0-1634203726406.png

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

vyalanwumsft_1-1634203792859.png

Or you could add conditional column in power query .

vyalanwumsft_2-1634203919985.png

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.

Anonymous
Not applicable

@Anonymous Parenthesis are unnecessary as is second 'each'.

selimovd
Super User
Super User

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
Not applicable

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

Supposely, all should be numbers or null. 

fucntion.PNG

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors