Power Query Number.Log10 Function: How to Use It
In this article
The Power Query Number.Log10 function calculates the base-10 logarithm of a number, useful for scaling data, analyzing exponential trends, or preparing values for statistical models. It requires a numeric input and returns a decimal result. No additional tools or installations are needed — it’s built into Power Query in Excel, Power BI, and other Microsoft data tools.
What You'll Need
- Microsoft Excel 2016 or later, or Power BI Desktop
- A table or query with at least one column containing numeric values
- Access to the Power Query Editor (via Data > Get & Transform in Excel or Transform Data in Power BI)
Step-by-Step
- Open your workbook in Excel or your report in Power BI Desktop and load the data you want to transform into Power Query Editor. Click Data > Get & Transform > From Table/Range in Excel, or Transform Data in Power BI.
- In the Power Query Editor, locate the column that contains the numeric values you want to apply the base-10 logarithm to. Ensure the column data type is set to Decimal Number or Whole Number. If it’s text, select the column, go to the Transform tab, and click Change Type > Decimal Number.
- With the column selected, go to the Add Column tab in the ribbon, then click Custom Column.
- In the Custom Column dialog box, enter a name for your new column — for example,
Log10_Value. - In the formula box, type:
Number.Log10([YourColumnName]). ReplaceYourColumnNamewith the exact name of your source column, including square brackets. For example, if your column is namedSales, writeNumber.Log10([Sales]). - Click OK. A new column will appear to the right of your source column, showing the base-10 logarithm of each value.
- Verify the results by checking a few rows manually. For example, if a value is 100, its Log10 should be 2. If it’s 1000, it should be 3. If it’s 1, the result should be 0. If the value is less than zero, the result will be an error — this is expected and handled in the next section.
- If needed, remove the original column by right-clicking its header and selecting Remove, or keep both for comparison.
- Click Close & Load to push the transformed data back into Excel or Power BI.
Common Mistakes
- Using text values instead of numbers — Power Query will return an error if you try to apply Number.Log10 to a column with non-numeric entries like "N/A", "-", or text labels.
- Forgetting the square brackets around the column name — typing
Number.Log10(Sales)without brackets will cause a syntax error. - Applying Log10 to zero or negative numbers — this triggers a
#valueerror because logarithms of non-positive numbers are undefined in real arithmetic. - Assuming the function works on multiple columns at once — Number.Log10 operates on one column at a time. You must create a separate custom column for each numeric column you want to transform.
- Not checking data types — if the column was imported as text from a CSV or database, the function won’t work until you explicitly convert it to a number type.
Tips
- Use
try Number.Log10([ColumnName]) otherwise nullto handle negative or zero values gracefully. This returns null instead of an error, allowing you to filter or replace later. - Combine with
Number.Roundto reduce decimal places:Number.Round(Number.Log10([Sales]), 2)gives you two-digit precision. - Apply Log10 to data with wide ranges (e.g., population sizes, sales figures) to linearize exponential growth patterns for better visualization.
- Before applying Log10, filter out rows with zero or negative values using the filter dropdown on the column header — select Number Filters > Greater Than and enter 0.
- Use the View > Formula Bar option to see the M code being generated. This helps you understand the underlying logic and debug complex transformations.
- When working with large datasets, test the formula on a sample of 100 rows first before applying it to the full dataset to avoid performance issues.
Troubleshooting
- Error: "We cannot apply operator Log10 to types Text and Number" — this means your column is still formatted as text. Go back, select the column, click Transform > Change Type > Decimal Number. If some values can’t be converted, Power Query will show them as errors — use Replace Errors under the Transform tab to replace them with null or zero.
- Result is blank or null — check if the source value was zero, negative, or missing. Use the filter icon on the Log10 column to exclude nulls or inspect the original column for invalid entries.
- Formula syntax error — double-check that you used square brackets around the column name. Also ensure you typed
Number.Log10exactly — no capitalization errors or extra spaces. - Performance is slow — if you’re working with over 100,000 rows, consider filtering your data first or applying the transformation in stages. Avoid multiple nested transformations; simplify the query if possible.
- Column doesn’t appear after clicking OK — make sure you didn’t accidentally click Cancel. Close the Custom Column dialog and reopen it. If the column still doesn’t show, check the Applied Steps pane on the right — if the step is missing, re-add it.
- Results don’t match calculator — verify you’re using base-10, not natural log. Number.Log10 is base-10. For natural log, use Number.Ln. Also confirm your source value is correct — a typo in the original data will carry through.
Frequently Asked Questions
Can I use Number.Log10 on a column with decimal values?
Yes, Number.Log10 works with any positive decimal number. For example, Log10(2.5) ≈ 0.39794.What happens if my data has blank or null values?
Power Query returns an error if you apply Number.Log10 to a null value. To avoid this, usetry Number.Log10([Column]) otherwise null to convert errors to nulls.
Can I apply Number.Log10 to multiple columns at once?
No, you must create a separate custom column for each column you want to transform. You can copy the formula and paste it into other custom columns, changing only the column name inside the brackets.Is Number.Log10 the same as LOG10 in Excel formulas?
Yes, it performs the same mathematical operation. However, Power Query’s Number.Log10 runs during data transformation before loading, while Excel’s LOG10 runs on the worksheet after data is loaded.Why does my Log10 result show many decimal places?
By default, Power Query displays full precision. UseNumber.Round(Number.Log10([Column]), 4) to limit to four decimal places, or change the column’s formatting under the Home tab > Number Format.
Can I use Number.Log10 in Power BI measures?
No, Number.Log10 is a Power Query function used during data transformation. In DAX (Power BI measures), use the LOG function with base 10:LOG([Column], 10).