Skip to main content
Applications are open for the 2024 Qlik Luminary Program. Apply by December 15 here.
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Help with Top N Timeseries line chart

I'm very new to Qlik Sense and I've hit a bit of a roadblock that I am hoping someone can help me with.

I'm trying to create a timeseries line chart with time on the x axis, the measurement on the y axis and a series for each category that I have. The problem is that I have hundreds of categories and I only want to display the top N categories where top is defined as the sum of the measurement for each category over the selected time period.

I've been playing around with Set Analysis to try and achieve what I want but I can't seem to get one that works correctly. The closest I got was using the following as my measurement:

if (aggr(RANK(SUM({$} my_measurement)), my_category) <= 10, SUM([my_measurement]))

But the above only gives me a data point per top series, and I need the complete time series displayed for each of the top N series.

Has anyone else done this already or have any suggestions?



14 Replies
Master II
Master II

Hi Caleb,

Did you make use of the Properties to limit the number of entries in the properties panel?



Sangram Reddy.

Not applicable

Thanks for the suggestion Sangram. I tried it and, unfortunately, the legend is still showing all the categories, not just the top ones.

Not applicable

Thanks to help from Ted and some other very smart people at Qlik, I have my answer. I thought I would post it for others who were tackling the same problem.

I was looking at it the wrong way. Since I was trying to limit one of the dimensions, I should have been using a calculated dimension, not a calculated measure.  Using my example data from above

The measure should be:


Them time dimension remains:


and the my_category dimension is where the calculation should take place. The calculation for Top 10 is:

=if(aggr(rank(sum(my_measure)),my_category ) <=10, my_category)

Not applicable

You can try this Expression :

=if(aggr(rank(sum(my_measure)),my_timestamp, my_category)<=10, my_measure)

use my_measure & my_timestamp as Dimension.

Contributor II
Contributor II

I know this is an old post but I just wanted to say thanks for this - I was having the same issue and this solved it. In my opinion, this is the way the default Top N functionality should work for a dimension. The way it currently works is not nearly as useful in most situations.