En un listado mostrar por cada país el top 3 de clientes

Buenas! En un listado quiero recoger, por cada país, el Top 3 de Clientes con mayor importe de ventas.

Estoy intentándolo con TopK Selector pero no consigo hacer ese doble filtro para que me muestre de cada país los 3 mejores clientes. ¿Cómo podría hacerlo? Gracias!!

image

Hello @Miguelga , if Google Translate is accurate, I’m guessing you want to group the clients by country, and then filter in only the top 3 clients from each group right?

Ranking Clients by Groups (Country).knwf (62.1 KB)

Here’s how I did it.

Sample input:
inputrankingclient

Results:
Outputrankingclient

The only caveat is that for clients with similar sales value, my workflow will choose three of the first occurrences only, without listing all client names for that matter. But I doubt in your dataset there’ll be such case, since your Sales value have decimal points, making each value unique.

I’m sure others can show an easier alternative workflow, but as for now, here’s what I have. Hope it helps.

1 Like

Good afternoon,

Thank you very much for your reply. We have been asked for the final result to include the top 3 customers in each country, but also to show what is the amount of sales.

Is this possible?
Thank you!

Yes, you can continue from the last node that I got there in my workflow. Convert the columns to a single column of clients info. (Maybe use Unpivot Node for this?), then use the Reference Row Filter to take back the original table content. Let me know if that confuses you, but I hope it doesn’t.

1 Like

Here’s the new workflow to get back the Sales Value: @Miguelga

Ranking Clients by Groups (Country).knwf (86.3 KB)

finaloutputranking

3 Likes

Hi @Miguelga

I followed a different approach. I used a Group Loop for every country. See:
Ranking Clients by Groups (Country) with loop.knwf (121.2 KB)


gr. Hans

2 Likes

Thank yoy so much!!! :smiley:

without your help it would not have been possible :slight_smile:

3 Likes

Thank you very much! Tomorrow I will also try this method to find the solution. How difficult it is to use Knime, a lot to learn :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.