Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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]
= SUMX(
TOPN(
10,
SUMMARIZE(Product, [ProductKey], "TotalSales",
SUMX(RELATED(InternetSales_USD[SalesAmount_USD]),InternetSales_USD[SalesAmount_USD]) +
SUMX(RELATED(ResellerSales_USD[SalesAmount_USD]), ResellerSales_USD[SalesAmount_USD]))
)
)
HI @Anonymous,
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
Regards,
Xiaoxin Sheng
@Anonymous , 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 : https://www.youtube.com/watch?v=QIVEFp-QiOk
in case sumx related will come at column name
example
SUMX(Product,RELATED(InternetSales_USD[SalesAmount_USD]))
@Anonymous 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.
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as 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 C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
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.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
97 | |
75 | |
65 | |
53 |
User | Count |
---|---|
144 | |
103 | |
98 | |
85 | |
64 |