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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
parvez933
Creator
Creator

sort

Hello Everyone!

Please help me with the below scenario

load * inline [
Products, Sales
P1, 123
P2, 234
P3, 345
P4, 456
P5, 567
P6, 678
P7, 789
P8, 891
P9, 911
P10, 124
];

Question:
With in a straight table, display the products whose rank(sales) ranges between 3 to 7 by using
1. Set Analysis with p()
2. By using the rank() in the if loop or other

Note:
The products should be from rank3 to rank7 in descending order.

I tried with the rownum() in the if loop, it is returning as per the rownum but not by the rank of sum. Any suggestions please.

2 Solutions

Accepted Solutions
Frank_Hartmann
Master II
Master II

StraightTable

Dimension:

=if(aggr(rank(Sales),Products)>=3 and aggr(rank(Sales),Products)<=7,Products)

Expression:

sum(Sales)

and sort sum(Sales) in ascending order!

View solution in original post

Frank_Hartmann
Master II
Master II

You will need to supress Null Values for your dimension

Unbenannt.png

View solution in original post

7 Replies
Frank_Hartmann
Master II
Master II

StraightTable

Dimension:

=if(aggr(rank(Sales),Products)>=3 and aggr(rank(Sales),Products)<=7,Products)

Expression:

sum(Sales)

and sort sum(Sales) in ascending order!

tresesco
MVP
MVP

I would do it like I showed at: your other post

parvez933
Creator
Creator
Author

Hey Frank!

I tried the way you suggested, but in the straight table I dint know why an extra row is showing in the bottom

Untitled.png

Please help me!

Frank_Hartmann
Master II
Master II

You will need to supress Null Values for your dimension

Unbenannt.png

parvez933
Creator
Creator
Author

Hey Frank!
Thank you for your response. The case is solved. But I have a small query! what is the difference of using rank(sales) to rank(sum(sale)) in the above scenario.
Frank_Hartmann
Master II
Master II

in your case using sum(Sales) will give you the extra value of 2283 for the Null values in your dimension. If you just use Sales you wont get the 2283. So i would prefer to always use sum(Sales) instead of just Sales
parvez933
Creator
Creator
Author

Thank You Frank! It got resolved.