Help with this calculated field on my table visual

I need to make a calculated field to show the top 6 supliers based on hours worked per employee, and set the rest of the supliers into group others (there are over 30 supliers and just need to show 6 of them and them others). The table needs to show big numbers of each suplier adding up the total hours per year.

Hi @Theodoro_Fogagnoli
you could use

to get the order. With the rank you can group (1-6 and others) with an

BR

2 Likes

Hi,

I’ve tryied

ifelse(RankFornecedor <= 6, {des_fornecedor}, ‘Others’)

But it is showing the names of the 6 top suplyers as des_fornecedor, I would like it to show as it individually name, can you help me with that @ErikG

Can you share the calculation for RankFornecedor as well?

1 Like

Hi @ErikG,

Here is the calculated field.

image

Also after ranking the top 6 I tryed a calculted field to group the rest into “Others”

image

Thanks for the help by the way.

At the ifelse you defined

ifelse(RankFornecedor <=6, "des_fornecedor", "others")

You are giving a fix string as output!
You can try something like

ifelse(RankFornecedor <=6, toString(RankFornecedor) , "others")

Hi @Theodoro_Fogagnoli
Any updates on your side?
BR

1 Like

I Did exacly what you said, but when I try to use it show that I cant as you see in the print.

Hi @Theodoro_Fogagnoli
any chance you can rebuild the rank like:

rank([{Horas Relizadas} DESC],[],PRE_AGG)

BR