Power Query Number.IntegerDivide Function Explained
In this article
The Number.IntegerDivide function in Power Query performs integer division, returning only the whole number result by discarding any remainder. It’s useful for splitting data into equal groups, calculating batches, or determining how many full units fit into a total — such as how many boxes you can fill with 24 items each from a stock of 100. No special setup is required beyond having Power Query enabled in Excel or Power BI, which is built-in for most modern versions.
What You'll Need
- Microsoft Excel 2016 or later, or Microsoft Power BI Desktop
- A data table or query with numeric columns to divide
- Basic familiarity with Power Query Editor (opening it via Data > Get & Transform > Transform Data in Excel, or Edit Queries in Power BI)
Step-by-Step
- Open your workbook in Excel or your report in Power BI and load the data you want to modify into Power Query Editor. To do this, select any cell in your table, then go to the Data tab and choose Transform Data (Excel) or click Edit Queries (Power BI).
- In Power Query Editor, locate the column containing the dividend (the number being divided). If you need to divide two existing columns, ensure both are numeric. If not, select the column, go to the Transform tab, and use Change Type > Whole Number.
- Click Add Column > Custom Column to create a new column for the result. In the Custom Column dialog box, give your new column a clear name like FullGroups or BoxesNeeded.
- In the formula box, type:
Number.IntegerDivide([DividendColumn], [DivisorColumn]). Replace[DividendColumn]with the actual name of your dividend column (e.g.,[TotalItems]) and[DivisorColumn]with your divisor column (e.g.,[ItemsPerBox]). If you’re dividing by a fixed number like 24, typeNumber.IntegerDivide([TotalItems], 24). - Click OK. Power Query will calculate the integer division for every row and display the result in the new column. For example, if TotalItems is 100 and ItemsPerBox is 24, the result will be 4 — not 4.1667.
- Review the output. If any row returns an error, check for null values or non-numeric entries in either column. You can filter out nulls using the filter dropdown on the column header and unchecking null.
- Once satisfied, click Close & Load to return the updated table to your worksheet or report. The new column will now be part of your data model.
Common Mistakes
- Using regular division (forward slash /) instead of Number.IntegerDivide — this returns decimals and defeats the purpose of integer division.
- Referencing column names incorrectly — if your column has spaces or special characters, you must use square brackets, e.g.,
[Total Items], notTotal Items. - Forgetting to convert text columns to numbers before dividing — if a column is stored as text, Number.IntegerDivide will return an error.
- Dividing by zero — if your divisor column contains 0 or null, Power Query throws an error. Always validate divisors before applying this function.
Tips
- Use Number.IntegerDivide when you need to calculate how many full containers, packages, or batches you can produce — it’s ideal for inventory, logistics, or manufacturing analytics.
- Combine it with Number.Mod to get the remainder:
Number.Mod([TotalItems], [ItemsPerBox])tells you how many items are left over after full divisions. - For fixed divisors, hardcode the number instead of referencing a column — it’s faster and clearer. Example:
Number.IntegerDivide([Sales], 100)to group sales into hundreds. - Use conditional logic to handle edge cases: wrap your function in an
ifstatement likeif [Divisor] <> 0 then Number.IntegerDivide([Dividend], [Divisor]) else nullto avoid errors. - After applying this function, sort or group your data by the new column to analyze patterns — e.g., how many orders fall into each full-box range.
Troubleshooting
If Number.IntegerDivide returns an error or doesn't calculate:
- Check for null values in either the dividend or divisor column. Use the filter dropdown on each column and uncheck null. Then refresh the query.
- Verify both columns are set to a numeric type. Select the column, go to Transform > Data Type, and ensure it’s set to Whole Number or Decimal. If it shows as Text, convert it.
- If dividing by a constant and getting an error, confirm you typed the number correctly. A typo like
Number.IntegerDivide([A], 024)may cause parsing issues — avoid leading zeros in numeric literals. - If the formula appears as text instead of calculating, check for missing square brackets around column names.
Number.IntegerDivide(TotalItems, 24)is invalid; it must be[TotalItems]. - Restart Power Query Editor or your application. Sometimes, caching issues cause formula display problems — close and reopen the editor.
- If you’re using a custom function or referenced table, ensure the source data hasn’t been renamed or restructured. Column names are case-sensitive and must match exactly.
Frequently Asked Questions
Can Number.IntegerDivide handle negative numbers?
Yes. It follows mathematical integer division rules: Number.IntegerDivide(-10, 3) returns -3, and Number.IntegerDivide(10, -3) returns -3. The result is rounded toward zero.
What’s the difference between Number.IntegerDivide and Number.RoundDown?
Number.IntegerDivide performs integer division between two numbers and discards the remainder. Number.RoundDown rounds any number down to the nearest integer — even if it’s not division. For example, Number.RoundDown(9.9) returns 9, but it doesn’t divide.
Can I use Number.IntegerDivide with decimal columns?
Yes. The function accepts both whole numbers and decimals. It will still return only the integer portion of the division result. So Number.IntegerDivide(10.5, 2.5) returns 4, not 4.2.
Does this work in Power BI DAX too?
No. Number.IntegerDivide is specific to Power Query (M language). In DAX, use the QUOTIENT function instead: QUOTIENT([Numerator], [Denominator]).
Why does my result show as decimal even though I used Number.IntegerDivide?
This usually happens if the new column’s data type was not set to Whole Number after creation. After adding the column, manually change its type via Transform > Data Type > Whole Number.
Is there a limit to how large the numbers can be?
Power Query handles integers up to 64-bit precision, so values up to ±9,223,372,036,854,775,807 are supported. For typical business data, this is more than sufficient.