web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Invalid operation: div...
Power Apps
Unanswered

Invalid operation: division by zero

(0) ShareShare
ReportReport
Posted on by

Hi guys!

 

I have a problem with my syntax, I want to put a percentage with this code (CM/PC)*100 with my variables, but when I want to calculate, putting my data, it show me "Invalid operation: division by zero" 

 

can you tell me why?

Categories:
I have the same question (0)
  • Verified answer
    CarlosFigueira Profile Picture
    on at

    If the value of PC is either 0 or blank (uninitialized), then you will have a division by zero, which is being shown in your app... If that's the case, then you will need to determine what you want the result to be. If you want a blank result, you can use an expression like the following:

    // since there is no "else" argument, the result will be blank if PC is blank or zero
    If (Not IsBlank(PC) And PC <> 0, (CM / PC) * 100)

    Another approach would be to use the IfError function, which can "catch" an error and replace it with something else:

    IfError( (CM/PC)*100, Blank() )

    Or you can replace it with some other value (for example, 0):

    IfError( (CM/PC)*100, 0 )

    Hope this helps!

  • Community Power Platform Member Profile Picture
    on at

    This help me a lot, thank you!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard