How do you calculate the difference between two columns in a Power BI table?

To calculate the difference between two columns in a Power BI table, you can use the DAX formula “Difference = Column A – Column B”. This formula subtracts the values in Column B from the values in Column A and returns the result as a new column. This calculation can be applied to any type of data, such as numerical values or dates, and can be used to analyze trends, compare performance, and identify anomalies in your data. The resulting difference column can then be visualized in various charts and graphs to gain insights and make data-driven decisions.


Often you may want to calculate the difference between two columns in a table in Power BI, such as the following table in which we calculate the difference between the Sum of Points and Sum of Assists columns:

Power BI calculate difference between two columns in table

Fortunately this is easy to do by creating a measure in DAX and then adding that measure as a column in the table.

The following example shows how to do so in practice.

Example: How to Calculate Difference Between Two Columns in Table in Power BI

Suppose we have the following table in Power BI named my_data that contains information about various basketball players:

Suppose we insert the following table into a report that shows the sum of points and sum of assists for each team:

Now suppose that we would like to add a new column that shows the difference between the Sum of Points and Sum of Assists columns in the table.

To do so, right click on the my_data table under the Data tab, then click New measure:

Then type the following formula into the formula bar:

Difference = SUM(my_data[Points]) - SUM(my_data[Assists])

This will create a new measure that calculates the difference between the Sum of Points and Sum of Assists columns in the table:

Lastly, we can add this new measure named Difference as a column in our table:

This new column will contain the difference between the Sum of Points and Sum of Assists columns in the table:

Power BI calculate difference between two columns in table

From the output we can see:

  • The difference between points and assists for the Hornets is 31 – 10 = 21.
  • The difference between points and assists for the Mavs is 75 – 21 = 54.
  • The difference between points and assists for the Rockets is 48 – 12 = 36.
  • The difference between points and assists for the Spurs is 65 – 18 = 47.

Additional Resources

The following tutorials explain how to perform other common tasks in Power BI:

x