Skip to main content

What is the difference between sumx and sum in power bi?

Table of Contents

In Power BI, SUM and SUMX are both used to perform summation, but they work in different ways:

  1. SUM:
    • SUM is a simple aggregation function that adds up the values in a single column.
    • It operates directly on the column and does not require any row-by-row calculation.
    • Example: SUM(Sales[Amount]) will return the total sum of the values in the “Amount” column of the “Sales” table.
  2. SUMX:
    • SUMX is an iterative function that allows you to perform calculations row-by-row over a table or expression, and then sums the results of those calculations.
    • It takes a table or an expression as its first argument and a calculation expression as its second argument.
    • Example: SUMX(Sales, Sales[Quantity] * Sales[UnitPrice]) will calculate the total sales by multiplying “Quantity” by “UnitPrice” for each row and then summing those results.

Add comment