Showing results for 
Search instead for 
Did you mean: 
Regular Visitor

Usage of SUMX and its syntax

Can anyone please explain the below DAX? When SUMX is supposed to have "Table" as its first argument, below code has column expression as its first parameter. Is it the right usage when the right syntax is supposed to be "Table" as yth

[sales of the top 10 sold products]
SUMMARIZE(Product, [ProductKey], "TotalSales",
SUMX(RELATED(InternetSales_USD[SalesAmount_USD]),InternetSales_USD[SalesAmount_USD]) +
SUMX(RELATED(ResellerSales_USD[SalesAmount_USD]), ResellerSales_USD[SalesAmount_USD]))

Community Support
Community Support


Perhaps you can take a look at the following blog, it mentions the usage of 'use related function work as filters':
DAX Filter - RELATED function 


Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.
Super User IV
Super User IV

@RADHIKA_3022 , I doubt you need related .


Create two measures like these


TotalSales = InternetSales_USD[SalesAmount_USD] +ResellerSales_USD[SalesAmount_USD]

Top 10 City Rank = CALCULATE([TotalSales],TOPN(10,all(Product[ProductKey]),[TotalSales],DESC),VALUES(Product[ProductKey]))


For TOPN Refer :


in case sumx related will come at column name



Did I answer your question? Mark my post as a solution! Appreciate your Kudos!!
Dashboard of My Blogs !! YouTube Channel !! Connect on Linkedin

Proud to be a Super User!

Super User III
Super User III

@RADHIKA_3022  Is this your data or sample file? SUMX first argument is a table or table expression, so TOPN returns a table, in your case with 10 rows. 

Has this post solved your problem? Please mark it as a solution so that others can find it quickly and to let the community know your problem has been solved. 

If you found this post helpful, please give Kudos. ?

I work as a trainer and consultant for Microsoft 365, specialising in Power BI and Power Query.

Thanks for responding.

But "Related" in the SUMX expression returns a scalar value, which is not a table/ table expression.. when SUMX is supposed to have TABLE of Values as its first argument. Hope you understand my point.


Helpful resources

PBI User Groups

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

April Update

Check it Out!

Click here to read more about the April 2021 Updates!

MBAS Carousel

Sign up for our May 4th event!

May the fourth be with you, join us online!


The largest Power BI virtual conference

100+ sessions, 100+ speakers, Product managers, MVPs, and experts. All about Power BI. Attend online or watch the recordings.