Forum Discussion
TopN function cant display on the matrix
Anonymous It looks like you're trying to use a Table function inside a MEASURE, so TOPN is returning an entire table of values, but you need to get that down to 1 scalar expression, which is what amitchandak 's suggestion will do for you.
By putting the TOPN inside a filter expression of a CALCULATE, you are forcing the measure to only calculate for the TOPN values, but you still need to define what the measure actually is (ie SUM(Orders[Sales]). If you do this only, then you will get the same value for every customer, ie total sales for top 10 customers combined:
IF you use a variable, then you can return each customer's total sales for only the Top10 customers:
Otherwise do your formula as a new TABLE rather than a MEASURE.
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.
AllisonKennedy thank you for the detailed explanation! that is very helpful for me to understand why... thanks again!