Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
New2qlik1
Contributor
Contributor

List box showing fewer values

Hi all, I have a list box that contains year/quarter but I only need to show the most recent 7 quarters.

2021 Q3

2021 Q2

2021 Q1

2020 Q4

2020 Q3

2020 Q2

2020 Q1 --

2019 Q4

2019 Q3

2019 Q2

2019 Q1

2018 Q4

2018 Q3

2018 Q2

2018 Q1

1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

if you want top 7 based on your selections, you can use a calculated dimension in your filter object.

=aggr(if(rank([Year Quarter Field]) <= 7, [Year Quarter Field]) ,[Year Quarter Field])

 

Otherwise you can create a flag (or another field entirely but that may be confusing on front end with conflicting selections) in your data model and use that in your filter object.

Example:

load script flag:

data:
load * inline [
field
1
6
4
3
2
]

;

left join (data)
load field, 1 as is_top_2 resident data
where rowno() <2
order by field desc
;

 

=if(is_top_2= 1, [field])

View solution in original post

1 Reply
stevejoyce
Specialist II
Specialist II

if you want top 7 based on your selections, you can use a calculated dimension in your filter object.

=aggr(if(rank([Year Quarter Field]) <= 7, [Year Quarter Field]) ,[Year Quarter Field])

 

Otherwise you can create a flag (or another field entirely but that may be confusing on front end with conflicting selections) in your data model and use that in your filter object.

Example:

load script flag:

data:
load * inline [
field
1
6
4
3
2
]

;

left join (data)
load field, 1 as is_top_2 resident data
where rowno() <2
order by field desc
;

 

=if(is_top_2= 1, [field])