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: 
Anonymous
Not applicable

Selecting n rows for each value of a selection?

A user currently has:

1) an input box to let her select a number of records she wants to see and

2) a straight table that pulls that many rows, assuming she's made a selection on Field A.

The issue is that she wants the record number she selects to be applied to each unique value of the selection. So if she sets the record count to 5 and selects values 42, 52, and 62, she wants to see 15 rows. 5 rows for each value in Field A. Obviously, I can't just multiply the record count by the number of values selected because there's no way to ensure she has an even number of rows to each value.

Does anyone have an idea what I could do to make this work? I'm not particularly experienced with Qlik macros, but I imagine there might be some way to do it there. I've struggling to even get started approaching this.

Any help is appreciated!

2 Replies
Anonymous
Not applicable
Author

I think I've found a possible route, but still need some help. If I expand the row limit of the straight table to:

(RowNo(TOTAL) <= $(vRecordSelectorCount)*GetPossibleCount([Field A]))

that should give me the proper max number. I also made a variable to list the possible values of Field A. The issue still exists of limiting each unique value to vRecordSelectorCount rows. Is there some way to check if the value of Field A matches a value in the variable and the row count for that Field A value is less than vRecordSelectorCount? I'm feeling progress, but still a bit stuck on the last part.

Colin-Albert

No need for Macros, you can do this using Dimension Limits on a straight table.

The dimension limit on the attached app is set as (vNumRows +1), the +1 allows for the "Others" rows to be included.

rowlimit.JPG