Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
YannikPrill
Contributor II
Contributor II

Show top 20% of several table entries

Hey QLIK Brains 🙂 

 

I need help with the following expression:

count(
{<
[A]=
{"=Rank(count([B]))/count(distinct total {1}[A])<=0.2"}
>}
[B]
)

 

"A" is a column that lists several customer names. "B" lists how many so called errors we had in total. The dimension of the table is the customer Name ("A") so that each customer gets linked to his errors. I now just want to display the top 20% of the customers in terms of how many errors we have had with them. 

 

With the given formula something in my table gets cut. The total number of errors shrinks from 238K to 220K. Still the number of customers stays the same and all are displayed. As I said I just want the 20% of customers with the most errors.

 

Can anyone figure out what I am missing? 

 

Thx in advance,

Yannik

1 Reply
JordyWegman
Partner - Master
Partner - Master

Hi Yannik,

Try this:

Table1:
Load
	*,
	RowNo() as RowNo
Load
	A,
	B
From Source
Order by B
;

Table2:
Load
	Count(B) as CountRows
Resident Table1;

let vCountRows = Peek('CountRows',0,[Table2]);

FinalTable:
Load
	*
Resident Table1
Where RowNo <= ($(vCountRows) * 0,2)

drop Table1;
drop Table2;

Jordy,

Climber

Work smarter, not harder