Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Top n / Bottom n

Morning,

I've read and tried a few suggestions on top n / bottom n on blogs / forums but none seem to work.

I have a calculated Expression which shows Week On Week performance based on last weeks sales and the week before.  All I need is the chart table to only display the highest 20 and lowest 20 performance based on this expression.

6 Replies
Anonymous
Not applicable
Author

Hi,

Maybe you can try this :

In the chart properties "Sort" tab, select your expression and select "Expression" in sort by.  Here you can sort Descending (from highest to lowest sales) or Ascending (from lowest to highest sales) and then enter the expression.

In the "Dimension Limits" tab, choose "Restrict which values are displayed ..." and select to show only the largest or smallest 20.

So, in fact, you need a table to show the highest 20 and an other table to show the smallest 20.

marcus_sommer

If you used two objects (for example straight tables) you could set those top/bottom 20 within the limitation tab. Within one object it's more complicated and you would need a calculated dimension like this:

= dual(

  if(aggr(rank(sum(Value), 4), Customer) < 21 or

     aggr(rank(sum(Value), 4), Customer) > $(=count(distinct Customer)) - 20, Customer),

  aggr(rank(sum(Value), 4), Customer))  

and as expression simply: sum(Value).

- Marcus

Not applicable
Author

Sorry I forgot to include that I need to restrict the ranked performance where sales are greater than £2000.

marcus_sommer

You could of course include further conditions, maybe in these ways:

sum({< Value = {">=2000"}>} Value)

sum({< Value = {"=sum(Value)>2000"}>} Value)

- Marcus

Not applicable
Author

Hi,

sum({<fieldname={''=aggr(rank(sum(sales),4),Sales")>}+fieldname={''=aggr(rank(-sum(sales),4),Sales")>}Sales)

if u want bottomu can use -sum(sales)

Not applicable
Author

Thanks for the replies so far.  I've not had chance to 'play' around this afternoon with your suggestions.