[Solved] Invalid operation: division by zero in Power Apps

Recently, while working on an IT Help Desk solution in Power Apps, I tried to retrieve all the records using Power Automate to avoid delegation issues.

However, we cannot retrieve all the records at once. To solve this, I implemented pagination, where records are loaded page by page.

After completing the development, when I ran the app, I encountered the following error:

Invalid operation: division by zero
Invalid operation division by zero Power APPs

This error usually occurs when a formula tries to divide a number by 0 or a blank value.

In my case, when the app started running, the data had not loaded yet, and the value used in the formula was 0 or blank, which caused the error.

In this tutorial, I will explain how I solved the “Invalid operation: division by zero” error in Power Apps.

Invalid operation: division by zero in Power Apps

In my app, I was using the following condition to control the pagination:

varPageNumberForHomeTickets < 
RoundUp(
    First(colTicketCount).Allitem / 8,
    0
)

Here, First(colTicketCount).Allitem is the total number of records, which I receive from a Power Automate flow.

The problem happened when the app started loading. At that moment, the flow data had not loaded yet, so First(colTicketCount).Allitem returned 0 or blank.

Because of that, the formula tried to perform a calculation with an empty value, which caused the error:

Invalid operation: division by zero
Invalid operation division by zero Power APPs

To solve the division by zero issue, I updated the formula to check whether the value from the collection is empty, blank, or zero before performing the calculation.

I used the following formula:

varPageNumberForHomeTickets <
RoundUp(
    If(
        IsEmpty(colTicketCount) || IsBlank(First(colTicketCount).Allitem) || First(colTicketCount).Allitem = 0,
        0,
        First(colTicketCount).Allitem / 8
    ),
    0
)

In this formula:

  • IsEmpty(colTicketCount) checks if the collection returned from the Power Automate flow is empty.
  • IsBlank(First(colTicketCount).Allitem) checks if the total record value is blank.
  • First(colTicketCount).Allitem = 0 checks if the value is zero.

If any of these conditions are true, the formula returns 0 and avoids the calculation. Otherwise, it divides the total number of records by 8 and rounds the value using RoundUp.

This ensures the formula only runs when the data is properly loaded, which prevents the Invalid operation: division by zero error in Power Apps.

Conclusion

The Invalid operation: division by zero error in Power Apps usually occurs when a formula tries to divide a number by 0 or a blank value.

In my case, the issue happened because the data returned from the Power Automate flow had not loaded yet, and the formula tried to perform the calculation using an empty value.

To fix this issue, I added checks to verify whether the collection value was empty, blank, or zero before performing the calculation.

Moreover, you may like some more Power Apps tutorials:

Live Webinar

Build an IT Help Desk App using Power Apps and Power Automate

Join this free live session and learn how to build a fully functional IT Help Desk application using Power Apps and Power Automate—step by step.

📅 29th Apr 2026 – 10:00 AM EST | 7:30 PM IST

Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial

FREE Power Platform Tutorial PDF

Download 135+ Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…