Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Pivot Table. Top3 Values

Hi friends!

I am trying to show only 3 values per category:

  • Facturas
  • Recuperado

So what I tried was this: =if(aggr(rank(SUM(Datos)),[Origen Factura])<=3,[Origen Factura],Null()) 

But It didn´t work, it only shoy me the 3 values per one category ( facturas) due to this category is much higher/bigger  than the other  one but what I want is 3 values per category not 3 in total.

Many thanks

14 Replies
Not applicable
Author

Hi Juan ,

Do you want to see the result like the below pic

no.JPG

Not applicable
Author

Exactly!

How do you get it?

Not applicable
Author

Hi Juan ,


Use this expression in dimension if(aggr(rank(SUM(Datos)),[Facturas_Recuperado],[Origen Factura])<=3,[Origen Factura])


I attached qvw for your reference .



tresesco
MVP
MVP

Expression:

=if(aggr(rank(SUM(Datos)),Facturas_Recuperado,[Origen Factura])<=3,[Origen Factura],Null())

'Supress When Value is Null' - checked.

Kushal_Chawda

create the calculated dimension as below

= aggr(if( rank(SUM(Datos),4)<=3,[Origen Factura]),Facturas_Recuperado,[Origen Factura])

check "Suppress when value is NULL"

john9inno
Creator
Creator

does it have to be Pivot rather than Straight table?

I believe better design would be show top3 and sum of the rest as 'Others'

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try this expressions

Nº Envios

=If(Rank(SUM({<Envios_Gastos={'NºENVIOS'}>}Datos)) <=3, SUM({<Envios_Gastos={'NºENVIOS'}>}Datos))

Gastos

=If(Rank(SUM({<Envios_Gastos={'GASTOS'}>}Datos)) <=3, SUM({<Envios_Gastos={'GASTOS'}>}Datos))

Regards,

Jagan.

tamilarasu
Champion
Champion

The same can be done by changing your expressions like below.


Nº Envios

SUM({<[Origen Factura]= {"=aggr(rank(SUM(Datos)),Facturas_Recuperado,[Origen Factura])<=3"},Envios_Gastos={'NºENVIOS'}>}Datos)

Gastos

SUM({<[Origen Factura]= {"=aggr(rank(SUM(Datos)),Facturas_Recuperado,[Origen Factura])<=3"},Envios_Gastos={'GASTOS'}>}Datos)

Not applicable
Author

It also works!!! Many thanks!