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

Announcements
Note: You may notice some temporary visual or styling issues in the Community. Our vendor is actively investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Row no or Record no

Hi,

I need the following data to be done with sort.

12 Replies
Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

I think you can you DUAL() Function for  this purpose.

IF(RANK < 1, DUAL('NAGATIVE',1)

     , RANK >= 1 AND RANK <= 1000, DUAL('Less than 1K',2)

      , RANK >= 1000 AND RANK <= 4000, DUAL('1K -4K',3)
           , RANK >= 5000 AND RANK <= 9000, DUAL('5K -9K',3)

               ,E.T.C)          AS Rank

ToniKautto
Employee
Employee

I do not understand what you are trying to do. Where do you plan to execute the sort? Why is the sort order relevant?

If you are looking at applying this as a field in your script, then I would suggest looking at interval match.

For a more detailed reply, please provide some more detaisl on the datat you have, and where you need to do the sort.

Not applicable
Author

Thanks Gabriel,

I tried the same but QV is giving 2 or 3 records in the sorting.

Could you please try in the QV and load the column?

i just need to cross check whether i have committed any mistake

Not applicable
Author

Thanks Toni for the reply,

Yes i have values that shows the price ranges of :

1-100,

100-999

1k-2k

3k-5k

so on. but these are not in the proper order, i need these values to show them in a list box as a filter where user can select the ranges to see how many products sold in that range.

i hope you get the requirement

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

Try change the range in my script to fit your purpose

if(Rank < 1, dual('Nagetive',1),

if(Rank >= 1 AND Rank <= 4000, dual('1K',2),

if(Rank >= 1000 AND Rank <= 4999, dual('2K - 4K',3)

,
if(Rank >= 5000 AND Rank <= 9000, dual('5K - 9K',4)

,
if(Rank >= 5000 AND Rank <= 9999, dual('10K - 19K',5)

)))))
AS RANK

ToniKautto
Employee
Employee

My suggestion is to use IntervalMatch to link the prices to the ranges.

In this context simply enumerate the range label so that you can use numeric sort in your list box. There is no need to ave the numbers going from 1-14, just use the lower limit as the number to set the intervals in order.

Also keep in mid that the range can not overlap, so the upper limit on one interval can not be identical to the lower limit on the following interval.

Not applicable
Author

Hi Gabriedl,

Thanks again but it is not giving me the proper results when i reload the QV and taken it into UI as a listbox

Not applicable
Author

Thanks Toni

the solution is correct but not suits to my correct scenario

1) i cant use join now as i have many other joins

2) i have two more fields to do the same kind of sorting too

Gabriel
Partner - Specialist III
Partner - Specialist III

Hi,

The problems is in how you have defined your rank in excel.

If you change that to 1000 - 4000 instead of K it will work with my suggestions