This field is required.
Only these extensions are allowed(.jpg, .JPG, .jpeg, .JPEG, .gif, .GIF, .png, .PNG)
Tags cannot contain the characters ' /, \\, #, ?, or ; >,< '
Only these extensions are allowed(.zip,.ZIP,.pdf,.PDF,.qvf,.QVF,.qvw,.QVW)
Discussion Board for collaboration related to QlikView App Development.
I want to establish some values according to the rank of the data on my field in my load script.
My table is like this:
I want it to rank my values so the output will be like this:
And finally I want to translate each rank value into a description, if it is less or equal to 2, then "Z", if not, "Y"
I don't know why I am wrong, but I can't get the statements right on the load script
Just add desc to order by statement:
LOAD * Inline [
If(Rank <= 2, 'Z', 'Y') as Result;
AutoNumber(VALUE) as Rank
Order By VALUE desc;
DROP Table Table;
View solution in original post
There is no direct rank function in script, but you can use AutoNumber to get you what you want:
Order By VALUE;
Thank you very much
Although I just noticed that I wrote the rank in the other way around, I mean, instead of:
Value Rank -----> Value Rank
4.4 4 4.4 1
0.9 1 0.9 4
3.2 3 3.2 2
1.92 2 1.92 3
Do you have any clue of how can I change it?
Thanks so much for your time
Here is another way by using Previous and Peek functions in an If statement:
As a result of it, your data model will look like the below:
Here is the latest version based on your requirement:
And the data model, just another way:
Thank youu It works perfectly! You just made my day
see my example file rank.qvw.
- it contains a sub providing flexible ranking mechanisms, such as ranking by autonumber or by rowno().- ranks can be split into half ranks for identical values (e.g. rank 11,12,13 -> 12, 12, 12)
Regards - Marcel