Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
skyline01
New Contributor III

top N filter returning more than N data points

I'm working Qlik Sense 3.2.  I have a single internal data table, with the following attributes:

ID

Region

Status

Days

I need to create a bar chart of Count(ID) vs Region.  The data for this bar chart must be filtered to rows where Status = 'Open'.  The data must be further filtered to the top 20 rows by Days.  I have implemented the following for my measure in the bar chart:

=Count(

{

$<ID = {"=Rank(Sum({$<Status = {'Open'}>} Days)) <= 20"}>

}

ID

)

Oddly enough, when I manually check the sums of counts across all dimension (Region) values, I get count = 21, not 20.  Everything else on the bar charts looks as expected, though (e.g., no unexpected Region values).  So, I tried different visualization types (e.g., table), and I get the same result.  So, the issue is not visualization type - specific.  I'm guessing it's due to a unique scenario in my data.  Unfortunately, I can't post my data.  (It's proprietary.)  To help simulate my data set to find the scenario, I profiled my data on all 4 attributes.  I'm not seeing anything unique, other than 2 rows where ID is null for Status <> 'Open'.  What could I be doing wrong that is resulting in 21 data points, rather than the expected 20?

1 Solution

Accepted Solutions

Re: top N filter returning more than N data points

Is it possible that two IDs in the top 20 have the same number for Sum({$<Status = {'Open'}>} Days)?

4 Replies

Re: top N filter returning more than N data points

Is it possible that two IDs in the top 20 have the same number for Sum({$<Status = {'Open'}>} Days)?

Re: top N filter returning more than N data points

May be check out this thread

Continuous Ranking (no missing Rank)

skyline01
New Contributor III

Re: top N filter returning more than N data points

Yes, it is possible.  And, in fact, I just checked my data, and I do indeed have that very scenario.  As usual, I'm sure this is where the business needs to step in to define how to handle ties.  Once defined, is it best to implement this business logic via the mode argument in Rank?

Re: top N filter returning more than N data points

Once defined, is it best to implement this business logic via the mode argument in Rank?

Most likely yes