Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 brunolelli87
		
			brunolelli87
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Dears,
How can I create 2 Different Ranks on a script?
The first should rank the field [P/L] by DVPG, and STCK, from the highest to the lowest number. Something like this:
| =Date(DVPG, 'DD/MM/YY') | STCK | =[P/L] | =RankPL | 
| 03/06/20 | AALR3 | 133,67813848367 | 1 | 
| 03/06/20 | ALPA4 | 64,142973331921 | 2 | 
| 03/06/20 | AGRO3 | 30,789542066738 | 3 | 
| 03/06/20 | ABEV3 | 20,420386147316 | 4 | 
| 03/06/20 | BBDC4 | 9,5068188443067 | 5 | 
| 03/06/20 | BBDC3 | 8,7670571185802 | 6 | 
| 03/06/20 | BEES3 | 8,0984205714725 | 7 | 
| 03/06/20 | BBAS3 | 5,7988908772231 | 8 | 
| 02/06/20 | AALR3 | 124,68524553113 | 1 | 
| 02/06/20 | ALPA4 | 62,313030626898 | 2 | 
| 02/06/20 | AGRO3 | 30,712761698131 | 3 | 
| 02/06/20 | ABEV3 | 19,98886100609 | 4 | 
The second should rank the field [ROE] by DVPG, and STCK, from the lowest to the highest number. Something like this:
| =Date(DVPG, 'DD/MM/YY') | STCK | ROE | =RankROE | 
| 03/06/20 | BBAS3 | 5,798890877 | 1 | 
| 03/06/20 | BEES3 | 8,098420571 | 2 | 
| 03/06/20 | BBDC3 | 8,767057119 | 3 | 
| 03/06/20 | BBDC4 | 9,506818844 | 4 | 
| 03/06/20 | ABEV3 | 20,42038615 | 5 | 
| 03/06/20 | AGRO3 | 30,78954207 | 6 | 
| 03/06/20 | ALPA4 | 64,14297333 | 7 | 
| 03/06/20 | AALR3 | 133,6781385 | 8 | 
| 02/06/20 | BBAS3 | 5,476822981 | 1 | 
| 02/06/20 | BEES3 | 7,63720399 | 2 | 
And at the end of the day, I would like to create a table like this:
As you can see here, for each date and STCK I'll have its rank for PL and ROE.
| DVPG | STCK | RANK_PL | RANK_ROE | 
| 03/06/2020 | AALR3 | 1 | 8 | 
| 03/06/2020 | ALPA4 | 2 | 7 | 
| 03/06/2020 | AGRO3 | 3 | 6 | 
| 03/06/2020 | ABEV3 | 4 | 5 | 
How can I do that?
Please, take a look at my sample data. I was trying to use the AutoNumber([P/L], DVPG) as RankPL and it's working well, but just for the very first table. It's not resetting the counter for the second one.
I'm using QlikView Personal Edition, so please help me with the codes... I can't open any file back.
Thank you so much
Best regards
Bruno Lelli
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Check out your other post
