- Power BI forums
- Get Help with Power BI
- Desktop
- Service
- Report Server
- Power Query
- Mobile Apps
- Developer
- DAX Commands and Tips
- Custom Visuals Development Discussion
- Health and Life Sciences
- Power BI Spanish forums
- Translated Spanish Desktop
- Training and Consulting
- Instructor Led Training
- Dashboard in a Day for Women, by Women
- Galleries
- Community Connections & How-To Videos
- COVID-19 Data Stories Gallery
- Themes Gallery
- Data Stories Gallery
- R Script Showcase
- Webinars and Video Gallery
- Quick Measures Gallery
- 2021 MSBizAppsSummit Gallery
- 2020 MSBizAppsSummit Gallery
- 2019 MSBizAppsSummit Gallery
- Events
- Ideas
- Custom Visuals Ideas
- Issues
- Issues
- Events
- Upcoming Events
- Community Blog
- Power BI Community Blog
- Power BI 中文博客
- Community Support
- Community Accounts & Registration
- Using the Community
- Community Feedback

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Get certified in Microsoft Fabric—for free! For a limited time, the Microsoft Fabric Community team will be offering free DP-600 exam vouchers. Prepare now

- Power BI forums
- Forums
- Get Help with Power BI
- DAX Commands and Tips
- Re: SUMX vs SUM | COUNTX vs COUNT | AVERAGEX vs Av...

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Anonymous

Not applicable

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

SUMX vs SUM | COUNTX vs COUNT | AVERAGEX vs Average

08-17-2021
07:52 AM

Hi all,

I have watched so many Youtube videos and blog posts about the difference between the aggregating vs itterative functions, but am still failing to grasp the concepts here.

Can someone please, in the most basic way possible, explain when to use each? What the difference is? How to apply the itterative functions correctly? I see way too much of this, and quite frankly, am discouraged that I'm not able to get over this hurdle.

Would appreciate any input. Thank you.

Solved! Go to Solution.

2 ACCEPTED SOLUTIONS

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

08-17-2021
08:08 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

08-17-2021
08:40 AM

Hi @Anonymous

Please don't get disheartened as sometimes it takes time to grasp concepts.

Lets take an example of SUM and SUMX. Suppose you have a Sales table in which Total Price is given to you at which the product was sold. Now if you have to find out the Total Revenue that were made then you can use the function SUM as follows -

Total Revenue = SUM('Sales'[Total Price])

But now suppost that in the Sales table, instead of giving Total Price, there are two columns - Quantity and Unit Price. Now if you have to find out the Total Revenue then if we just see the maths behind it then we will have to multiply Quantity with Unit Price to get the Total Price for the transaction and then we will have to sum this Total Price obtained from the measure to get the Total Revenue. Now this is a two step process, first we have to multiple the Quantity with Unit Price and then once this is done for all transactions then we will have to add them. SUM function is not having the ability to do this two fold process and therefore SUMX comes into play. Here is how you can create a measure using SUMX-

Total Revenue = SUMX ('Sales', 'Sales'[Quantity] * 'Sales'[Unit Price])

The second part of sumx where expression is written helps in performing calculation for each row present in the dataset and then once that is done the Sum of the end result of that expression is done.

Hope this clarifies.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks

Radhika

2 REPLIES 2

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

08-17-2021
08:40 AM

Hi @Anonymous

Please don't get disheartened as sometimes it takes time to grasp concepts.

Lets take an example of SUM and SUMX. Suppose you have a Sales table in which Total Price is given to you at which the product was sold. Now if you have to find out the Total Revenue that were made then you can use the function SUM as follows -

Total Revenue = SUM('Sales'[Total Price])

But now suppost that in the Sales table, instead of giving Total Price, there are two columns - Quantity and Unit Price. Now if you have to find out the Total Revenue then if we just see the maths behind it then we will have to multiply Quantity with Unit Price to get the Total Price for the transaction and then we will have to sum this Total Price obtained from the measure to get the Total Revenue. Now this is a two step process, first we have to multiple the Quantity with Unit Price and then once this is done for all transactions then we will have to add them. SUM function is not having the ability to do this two fold process and therefore SUMX comes into play. Here is how you can create a measure using SUMX-

Total Revenue = SUMX ('Sales', 'Sales'[Quantity] * 'Sales'[Unit Price])

The second part of sumx where expression is written helps in performing calculation for each row present in the dataset and then once that is done the Sum of the end result of that expression is done.

Hope this clarifies.

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks

Radhika

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

08-17-2021
08:08 AM

Personally, I found these very helpful:

Power BI DAX Back to Basics: Scalar Vs. Tabular Functions - RADACAD

SUM vs SUMX; What is the Difference of the two DAX Functions in Power BI? - RADACAD

Announcements

Check out the October 2024 Power BI update to learn about new features.

Learn from experts, get hands-on experience, and win awesome prizes.

Top Solution Authors

User | Count |
---|---|

34 | |

14 | |

12 | |

12 | |

11 |

Top Kudoed Authors

User | Count |
---|---|

61 | |

20 | |

20 | |

15 | |

11 |