Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

fmazzarelli
Contributor III

TOP VALUE

Hi Community,

I use the left function to extract the first 4 characters of a string. The function works correctly but displays all records (with data and no data). Is there a TOP function in order to display only the first "n" values?


In the image below is the DTINRA filter box

8 Replies
jsf_fasoli
Contributor II

Re: TOP VALUE

Hi Fabio,

¿Can you attach sample data? ¿Which is the new field generated with the left sentence?

Grazie,

Josefina

fmazzarelli
Contributor III

Re: TOP VALUE

Hi,

my box filter  use a dimension "year".

2018, 2017, 2016, 2015, 2014, 2013, 2012, 2011, 2010, 2009

Data are the last 10 years.

I need a top function (similar to sql) showing only the last 3 years (2018,2017,2016)

thiago_justen
Valued Contributor III

Re: TOP VALUE

Maybe this will be helpful:

Only({<Year={"=$(=rank(Year)<=3)"}>}Year)

This will show only three last years as you want to.

Cheers

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
omarbensalem
Esteemed Contributor

Re: TOP VALUE

so basically, you have a filter : year : containing 10 years or so;

and u want to have a new filter, that shows only the last 3 years? is that so?

if that the case:

create a master dimension:

Capture.PNG

The dimension would be :

=aggr(if(Year> max({1}total Year)-3,Year,Null()),Year)

result:

Capture.PNG

thiago_justen
Valued Contributor III

Re: TOP VALUE

Fabio,

If any response above was helpful, please, close this thread by marking the correct response and those responses wich were helpful.

Cheers

Thiago Justen Teixeira Gonçalves
WhatsApp: 24 98152-1675
Skype: justen.thiago
omarbensalem
Esteemed Contributor

Re: TOP VALUE

u know, sometimes I try so hard to help, I would test and retest... for hours till I find the right solution and would be very excited and happy I could help.

I would expect some kind of recognizition for the time and effort I've put (even on holidays or weekends); but 50% of the ones who ask questions, once their problem is solved, won't even bother to thank us..

ps: my msg is not adressed to Fabio; It's a general thought I wanted to share.

mohan_1105
Contributor III

Re: TOP VALUE

Dear Fabio,

Please take a minute to review the responses, and mark any Helpful or Correct answers.

You can mark upto two helpful answers and one correct answer. This rewards other members for taking the time to assist you and also closing this thread will help others facing the similar issue.

zebhashmi
Valued Contributor

Re: TOP VALUE

Rank(yourField, n)