March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello All,
I have read so many articles but not able to understand when someone should use Sum and SumX , Average and AverageX.
Can someone explain with basic example ?
Thanks
Solved! Go to Solution.
Hi @koolsid786
SUM function: The SUM function calculates the sum of a specified column in a table. It takes a column or an expression that evaluates to a column as an argument.
SUM(<column>)
Example: Consider a table called "Sales" with columns "Product" and "SalesAmount." To calculate the total sales amount, you can use the SUM function as follows:
TotalSalesAmount = SUM(Sales[SalesAmount])
SUMX function: The SUMX function calculates the sum of an expression for each row in a table or an iterator. It iterates over each row and performs the specified calculation on the expression.
SUMX(<table>, <expression>)
Example: Suppose you have a table called "Orders" with columns "Product," "Quantity," and "Price." To calculate the total revenue for each product (quantity multiplied by price), you can use the SUMX function as follows:
TotalRevenue = SUMX(Orders, Orders[Quantity] * Orders[Price])
This will iterate over each row in the "Orders" table, calculate the revenue for each row (Quantity * Price), and then sum up the results to provide the total revenue.
Best Regards,
Ajith Prasath
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @koolsid786
SUM function: The SUM function calculates the sum of a specified column in a table. It takes a column or an expression that evaluates to a column as an argument.
SUM(<column>)
Example: Consider a table called "Sales" with columns "Product" and "SalesAmount." To calculate the total sales amount, you can use the SUM function as follows:
TotalSalesAmount = SUM(Sales[SalesAmount])
SUMX function: The SUMX function calculates the sum of an expression for each row in a table or an iterator. It iterates over each row and performs the specified calculation on the expression.
SUMX(<table>, <expression>)
Example: Suppose you have a table called "Orders" with columns "Product," "Quantity," and "Price." To calculate the total revenue for each product (quantity multiplied by price), you can use the SUMX function as follows:
TotalRevenue = SUMX(Orders, Orders[Quantity] * Orders[Price])
This will iterate over each row in the "Orders" table, calculate the revenue for each row (Quantity * Price), and then sum up the results to provide the total revenue.
Best Regards,
Ajith Prasath
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
SUM vs. SUMX:
Hi Ajith,
Can you please explain with Example ?
Additionally I am facing dificultiies in generating Dax formulas how to practice those ?
For Ex. In the below screen shot I have used Distinct but the Asnwer is showing that we should use Summarize ? Which function to be used when how to understand those ?
Hi @koolsid786
you can use the x aggregators when you need to get access to row context otherwise just use normal SUM, AVERAGE etc.
This reference guide gives some good examples: https://dax.guide/sumx/
First examples shows similarities:
I am facing dificultiies in generating Dax formulas how to practice those ?
For Ex. In the below screen shot I have used Distinct but the Asnwer is showing that we should use Summarize ? Which function to be used when how to understand those ?
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
23 | |
16 | |
12 | |
9 | |
7 |
User | Count |
---|---|
38 | |
32 | |
28 | |
12 | |
11 |