Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Power Query Number.Exp Function: How to Use It

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

The Number.Exp function in Power Query calculates e raised to the power of a given number, where e is Euler’s number (approximately 2.71828). This is essential for exponential growth modeling, statistical transformations, and financial calculations. No additional tools or installations are needed—this function is built into Power Query and works directly within Excel, Power BI, or any environment using the M language.

What You'll Need

  • A dataset loaded into Power Query (via Excel Data tab or Power BI Get Data)
  • A numeric column or value to apply the exponential function to
  • Basic familiarity with Power Query Editor (opening, transforming columns)

Step-by-Step

  1. Open your data source in Power Query Editor. In Excel, go to Data > Get & Transform > From Table/Range. In Power BI, use Get Data and select your source (Excel, CSV, SQL, etc.), then click Edit.
  2. Identify the column containing the numeric values you want to apply Number.Exp to. For example, if you’re modeling compound growth, this might be a column named "InterestRate" or "TimePeriod".
  3. In the Power Query Editor, select the column header to highlight the entire column. You must select the column—not just a cell—so the transformation applies to all rows.
  4. Go to the Transform tab, then click on "Scientific" in the Number group. From the dropdown, select "Exponential". This automatically generates the M code: Table.AddColumn(#"PreviousStep", "ExpValue", each Number.Exp([ColumnName]), type number).
  5. If you prefer writing code manually, go to the Advanced Editor and insert a custom column using: Number.Exp([YourColumnName]). Replace "YourColumnName" with the actual name of your column. Ensure the column name matches exactly, including capitalization and spaces.
  6. Review the new column. Power Query will display the results in real time. Each value should now be e raised to the power of the original number. For example, if the original value was 1, the result will be approximately 2.71828.
  7. Click Close & Load to apply the transformation and return the updated table to your worksheet or report.

Common Mistakes

  • Applying Number.Exp to non-numeric columns (e.g., text, dates) will cause an error. Always validate column data types before transforming.
  • Using incorrect column names in custom M code. If the column was renamed earlier, the original name won’t work. Check the column name in the Applied Steps pane on the right.
  • Forgetting to select the column before applying the Transform > Scientific > Exponential option. This will gray out the option until a numeric column is selected.
  • Using the function on null values—Power Query returns null for Number.Exp(null). If your data has missing values, handle them first with if [Column] = null then null else Number.Exp([Column]).
  • Expecting integer outputs. Number.Exp always returns a decimal. If you need rounding, apply Number.Round afterward.

Tips

  • Use Number.Exp in combination with Number.Ln (natural logarithm) to reverse the transformation. This is useful for modeling log-linear relationships.
  • When modeling exponential growth over time, combine Number.Exp with multiplication: Number.Exp([Rate] * [Time]) for continuous compounding formulas.
  • For large values in your source column (e.g., > 700), Number.Exp may return infinity due to floating-point limits. Consider scaling down inputs or adding a conditional check: if [Value] > 700 then "Too Large" else Number.Exp([Value]).
  • Use the Format menu to set decimal places in the new column. Right-click the column header > Format > Number > Decimal Places.
  • Test the function on a small sample first. Add a custom column with just 5 rows of sample data to verify syntax and output before applying to your full dataset.

Troubleshooting

  • Error: "We cannot convert the value null to type Number" → Your source column contains nulls. Use Transform > Replace Values to replace nulls with 0 or another safe value before applying Number.Exp.
  • Error: "The name 'ColumnName' was not recognized" → The column name in your M code doesn’t match the actual column name. Go to the Applied Steps pane and verify the exact name. If you renamed the column, use the new name.
  • The new column shows #NUM! or infinity → The input values are too large. Check if any value exceeds 709.782 (the approximate maximum before overflow). Filter out or cap high values before applying Number.Exp.
  • No "Exponential" option under Transform > Scientific → You may not have selected a numeric column. Deselect all columns, then reselect only the numeric one. If the option still doesn’t appear, your column might be a text type. Change it first using Change Type > Decimal Number.
  • Results don’t match manual calculation → Double-check that you’re using base e (Number.Exp), not base 10 or another base. Number.Exp is specifically e^x, not 10^x.

Frequently Asked Questions

What is Number.Exp used for in real-world scenarios?

It’s commonly used in finance for continuous compounding interest, in statistics for log-normal distributions, and in engineering for decay or growth models where the rate of change is proportional to the current value.

Can I use Number.Exp with negative numbers?

Yes. Number.Exp(-2) returns approximately 0.1353, which is 1/e². Negative inputs are valid and produce values between 0 and 1.

Does Number.Exp work the same in Excel formulas and Power Query?

No. In Excel, you’d use =EXP(A1). In Power Query, you use Number.Exp([A1]). They perform the same mathematical function but belong to different languages (Excel formula vs. M language).

Why does my result differ from a calculator?

Most calculators display rounded outputs. Power Query uses full precision (double-precision floating point). Your calculator may show 2.72, but Power Query returns 2.718281828459045. The difference is due to rounding, not error.

Can I apply Number.Exp to multiple columns at once?

Yes, but not with one click. Use the "Add Custom Column" option and reference multiple columns in a single expression, like Number.Exp([Rate]) * Number.Exp([Time]). Or use List.Transform to apply it across a list of columns programmatically.

What happens if I apply Number.Exp to text?

Power Query returns an error. Always ensure the column is set to type Decimal Number or Whole Number. You can convert text to number first using Transform > Data Type > Decimal Number.