Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
fmazzarelli
Partner - Creator III
Partner - Creator 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
Anonymous
Not applicable

Hi Fabio,

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

Grazie,

Josefina

fmazzarelli
Partner - Creator III
Partner - Creator III
Author

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_

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
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
OmarBenSalem

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_

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
Farol BI
WhatsApp: 24 98152-1675
Skype: justen.thiago
OmarBenSalem

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
Partner - Creator III
Partner - Creator III

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
Specialist
Specialist

Rank(yourField, n)