Forum Discussion
Top 10 Customers excluding one Customer Name
I am trying to Obtain the Top 10 Customers in Sales with the exclusion of 1 Customer.
I have this so far, but getting an error.
Hi Rocky_Brown
Thanks for reaching out to us.
if you want to create a table with top 10 customers, you can try this,
sample data
create the rank measure
RANK = RANKX( SUMMARIZE(ALL('Table'),'Table'[CustomerID]) , CALCULATE( SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[CustomerID])),,DESC,Dense)create the top 10 table,
Top 10 Customers CY Month = var _t=FILTER('Table',[RANK]<=10) return DISTINCT(SELECTCOLUMNS(_t,"customer name",[CustomerName],"rank",[RANK]))Top 10 Customers CY Month =Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.
4 Replies
- ryan_mayu
Super User
- Rocky_Brown
Helper I
I am just tring to make it a measure, I am confused about making it a table. When I use your code for a measure, I am getting an error. "The expression refers to Multiple Columns. Multiple Columns cannot be converted to a scalar value".
Thanks
- ryan_mayu
Super User
Creating a table is a workaround for you. let's see if any expert can create a measure for this.
- v-xiaotang
Community Support
Hi Rocky_Brown
Thanks for reaching out to us.
if you want to create a table with top 10 customers, you can try this,
sample data
create the rank measure
RANK = RANKX( SUMMARIZE(ALL('Table'),'Table'[CustomerID]) , CALCULATE( SUM('Table'[Sales]),ALLEXCEPT('Table','Table'[CustomerID])),,DESC,Dense)create the top 10 table,
Top 10 Customers CY Month = var _t=FILTER('Table',[RANK]<=10) return DISTINCT(SELECTCOLUMNS(_t,"customer name",[CustomerName],"rank",[RANK]))Top 10 Customers CY Month =Best Regards,
Community Support Team _Tang
If this post helps, please consider Accept it as the solution to help the other members find it more quickly.