Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

limit number of values in a straight table

Hi all!

i have a straight table with 3 dimensions (product ID is a calc dim and 2 others) and some expressions.

one of the dimensions is the City name.

I would like to limit the number of product IDs that are from the same city.

how can I do this in a straight table?

thanks!

10 Replies
Not applicable
Author

Hi, I really need your help in this

for example, this is what i have today:

productIDCity namesort odrder
5NYC1
6NYC2
2NYC3
1Paris4
7Paris5
4Paris6
3NYC7

i want to have this:

productIDcity namesort order
5NYC1
6NYC2
1Paris4
7Paris5

thank you!

dmac1971
Creator III
Creator III

Yes its possible.  In your straight table add City Name and Sort order as dimensions, then in your expression put in :

=sum(if(productID >= 4, productID))

This will give you required output.  Just rearrange the cols to suit by dragging and dropping.

antoniotiman
Master III
Master III

Hi,

are You sure about ProductID Paris  (7,4 or 1,7) ?

dmac1971
Creator III
Creator III

Antonio agreed, think there is a mistake in the OP's required table.  Output will be :

   

Product ID City name Sort Order
5NYC1
6NYC2
4Paris6
7Paris5
Not applicable
Author

In "dimension limit" tab -> "Limits" , you can set different criteria, for more you can set a variable which in the expression in order to limit the display numbers. To displays for specific id, you can use a "if" statement in "expression" tab!

Not applicable
Author

Hi,

the table above is just an example, the product ID can be any value.. my intention is to have only 2 values of every city name (with the highest sorting value).

thank you!

Not applicable
Author

sorry, you are correct.

fixed

dmac1971
Creator III
Creator III

Yes you could use if greater or equal to Max no -1.  That will give you output you need.

antoniotiman
Master III
Master III

You need Calculated Dimension like

=Aggr(If(Rank(-[sort odrder]) <= 2,productID),[City name],productID)

Check 'Suppress when value is null'

Regards,

Antonio