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

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

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:
- Getting your data Power Apps Error
- You don’t have permission to view this data error in Power Apps
- Power Apps Patch Error: The type of this argument ‘Attributes’ does not match the expected type ‘Record’. Found type ‘Text’

Hey! I’m Bijay Kumar, founder of SPGuides.com and a Microsoft Business Applications MVP (Power Automate, Power Apps). I launched this site in 2020 because I truly enjoy working with SharePoint, Power Platform, and SharePoint Framework (SPFx), and wanted to share that passion through step-by-step tutorials, guides, and training videos. My mission is to help you learn these technologies so you can utilize SharePoint, enhance productivity, and potentially build business solutions along the way.