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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
stefania_f
Contributor II
Contributor II

Ranking with filter

I need to insert in the "Ranking" column a value that gives a rank of the "Material" column for a single "ID" considering the value present in the "Values" column.

The ranking value remains unchanged if a filter on the material is applied to the table below.

Thank you

 

3 Replies
Sue_Macaluso
Community Manager
Community Manager

Good Day, Is this for QlikView or Sense? I would like to move it into the correct product forum
Did you find a solution to your question? Mark the solution as accepted : and if you found it useful, press the like button!
nilkanthraval
Contributor
Contributor

Hi Stefania,

Please find below the solution for Qliksense. it will give you the expected result as per excel file attached by you.

Let me know if you have any other questions.

Data456:
LOAD RowNo() as SrNo3,
*;
LOAD * INLINE [

Material, ID, Valori
A, ID1,10
B, ID1,13
C, ID1,15
A, ID2,9
B, ID2,10
C, ID2,7
A, ID3,21
B, ID3,28
C, ID3,24
];
store Data456 into [lib://RawQVD/Data456.QVd];
drop table Data456;

RankingifData:
load *,
ID &'-'&Valori as NewUniqueField
from [lib://RawQVD/Data456.QVd](qvd);
store RankingifData into [lib://RawQVD/RankingifData.QVd];

RankingifDataNew:
Load *,
if (Previous(ID) = ID ,Peek(RowNumberCount1)+1,1 ) as RowNumberCount1
resident RankingifData
order by NewUniqueField;
Drop table RankingifData;
store RankingifDataNew into [lib://RawQVD/RankingifDataNew.QVd];


NumberingMapping:
Mapping load
NewUniqueField,
RowNumberCount1
resident RankingifDataNew;


RankingifData1:
load
Material as NMaterial,
ID as NID,
Valori as NValori,
ApplyMap('NumberingMapping',NewUniqueField, 'Na') as NID123
from [lib://RawQVD/RankingifData.QVd](qvd);

drop table RankingifDataNew;

 

 

 

 

nilkanthraval
Contributor
Contributor

You store the QVD and recall the QVD, Rank value will remain unchanged.