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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Raph
Helper III
Helper III

M Language : If with multiple conditions

Hello,

 

I am trying to write a formula saying : if both conditions (Historique >2000 and royalties < 0.22) are fullfilled it should return "To adapt"... otherwise it returns OK.

In the formula below, it returns "Error"  for each line where Historique > 2000. Could you please help me to solve this ?

 

= Table.AddColumn(#"Royalties exception développé", "Check royalt. > 2000", each if [#"Historique "] > 2000 and [#"Royalties exception.%roy."] < 0.22 then "To adapt" else "OK")

 

Thank you very much.

 

Best regards

 

Raphaël

1 ACCEPTED SOLUTION

Hello @parry2k 

 

Thank you for your answer. This column is number type... in the meantime I tried this

 

= Table.AddColumn(#"Colonnes supprimées", "Check royalt.", each if [#"Historique "]>2000 and [#"Royalties exception.% roy."]<0.22 then "TO ADAPT" else "OK")

 

And it seems to work... Not sure to understand why.

 

Thank you for your time.

 

Raphaël

View solution in original post

5 REPLIES 5
parry2k
Super User
Super User

@Raph what is the data type of historique column, make sure it is number.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Hello @parry2k 

 

Thank you for your answer. This column is number type... in the meantime I tried this

 

= Table.AddColumn(#"Colonnes supprimées", "Check royalt.", each if [#"Historique "]>2000 and [#"Royalties exception.% roy."]<0.22 then "TO ADAPT" else "OK")

 

And it seems to work... Not sure to understand why.

 

Thank you for your time.

 

Raphaël

@Raph interesting, can you try to rename this column name to the name you originally wanted, just wondering what is causing that you cannot have that column name, may be > this symbol but good to check though.

 

ANyhow, your problem is solved 🙂



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k  It works also with the previous column name... the only differences are the spaces that I removed next to the > and < in the formula.

 

Thank you

@Raph good to know, totally weird. I would like to test it any end. Anyhow, thanks for letting me know.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.