# How to only show top 10 best clients?

Hi,

I’m trying to show a bar graph of the Top 10 Clients from a table. Here is my logic and first steps:

1. I have a raw database with clients and revenue
2. I add a column with a formula for “Accumulates Sales”
3. I then filter the table to only show unique clients and their accumulated sales.
4. Then I’d like to create a graph to only show top 10 clientes. I tried to use Slice () but it doesn’t work.

I’m stuck and it’s not working… any ideas?

I think it’s not working because: The Slice() formula filters every row in the table and not only the unique client values.

Here’s the doc: Show top 10 clients?

hi @Hector_Reyes , I am a bit short in time, however this part may help you:

`thisTable.Filter([Accum. Sales].Contains(thisRow.[Accum. Sales])).First().Contains(thisRow)`

and to slice it up:

`thisTable.Filter([Unique values]=true).Slice(1,10)`

the next step is using this column in a graph, hope it helps a bit, cheers, Christiaan

1 Like

and this is the view

the formula behind is:

`thisRow.[Unique values] = true and thisTable.Find(thisRow) >= 10`

The `slice()` is good as part of a calculation, not so much to create the visual you had in mind, that is the result of a filter.

Enjoy, Christiaan

1 Like

Wow!

Thank you so much @Christiaan_Huizer!

Hi @Christiaan_Huizer ! I’m trying this out but it’s not working, don’t know the exact reason why but I’ll hopefully get back soon

did you see this part
so the filter is right up

what you do is create a new view of the table and this table you turn into a chart

• you have table 1 with the data
• you have table 2 with the filtered view
• you have the chart based on table 2

does this help?

Thanks again for your comments. I couldn’t make it happen with those formulas, it seems that the filters overlap from the raw data table.

But, I found a workaround with some help from support:

1.- Transform the “Client” column to Lookup
2.- Create the Lookup table with “Clients”
3.- Add a “Accum. Sales” Column
4.- Use a filter on that table to only show top 10 →
thisRow.In(thisTable.Sort(false(),thisTable.[Accum. Sales]).Slice(1,10))

I made a “Option B” page to show how it works:

Let me know what you think! Thanks!