Power Query Problems

How to Subtract Positive and Negative Values in Power Query

Rana GarciaRana Garcia Nov 3, 2026 870 views

Question details

The user needs to learn how to correctly calculate the mathematical difference between two amount columns in Power Query when the numbers contain a mix of positive and negative signs.

How to Subtract Positive and Negative Values in Power Query
Product
Power Query
Device & OS
not provided
Scenario
Calculating differences across multiple numerical columns where positive, negative, or mixed sign combinations complicate the mathematical logic.
Observed behavior
The goal state is to establish the correct logic (whether straightforward subtraction or comparing absolute values) to yield accurate differences for every possible sign combination.
Before you start

Before you begin, clearly define the business rule for your calculation to determine whether you need a straightforward mathematical difference or a difference based on absolute values.

Solution 1Recommended

Calculate a Straightforward Signed Difference

Use this method when you need a simple mathematical subtraction between two columns, respecting standard algebraic rules.

In a straightforward mathematical subtraction, subtracting a negative number is equivalent to adding its absolute value. For instance, 10 minus -5 equals 15. This is the default behavior when subtracting standard numeric columns in Power Query.

1
Open the Custom Column dialog

In the Power Query Editor, navigate to the 'Add Column' tab on the ribbon and click on 'Custom Column'.

2
Enter the straightforward subtraction formula

Name your new column (e.g., 'Difference'). In the Custom column formula box, enter the formula: [Amount2] - [Amount1].

3
Apply and format

Click 'OK' to create the column. Change the data type of the new column to 'Decimal Number' or 'Currency' by clicking the icon in the column header.

Calculate a Straightforward Signed Difference
Check Data Types: Ensure both input columns are set to a numerical data type before performing the subtraction. If they are formatted as Text, you will encounter a data type error.
Free Microsoft Office alternative

Calculate and Analyze Data Easily with WPS Office

While Power Query is a specific Microsoft Excel feature, WPS Office provides a highly compatible, lightweight, and free alternative for all your spreadsheet data analysis needs. You can easily calculate absolute and signed differences using standard spreadsheet functions.

Fully compatible with Microsoft Excel (.xlsx) formats and formulas.Easily handle complex mixed-sign calculations using native ABS and SIGN functions.Lightweight architecture runs smoothly on older devices without system lag.Free to use with a familiar interface for seamless transition.
microsoft office alternative - wps office

Frequently Asked Questions

What happens if I subtract a negative number from a positive number in Power Query?

Mathematically, subtracting a negative number is equivalent to adding its absolute value. For example, [Amount2] - [Amount1] where Amount2 is 5 and Amount1 is -3 will calculate as 5 - (-3), resulting in 8.

How do I handle null or empty values when subtracting columns?

If a column contains null values, a standard subtraction operation will result in a null value. To prevent this, replace nulls with zeros before subtracting by right-clicking the column header, selecting 'Replace Values', and changing 'null' to '0'.

Can I use Excel formulas like ABS and SIGN directly in Power Query?

No, Power Query uses the M language, which operates differently from standard Excel formulas. Instead of Excel's ABS() and SIGN(), you must use Power Query's native functions: Number.Abs() and Number.Sign().

Why is my custom column formula returning an error?

The most common cause for arithmetic errors in Power Query is mismatched or incorrect data types. Ensure that the columns you are attempting to subtract are explicitly formatted as 'Whole Number', 'Decimal Number', or 'Currency', rather than 'Text' or 'Any'.