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

Announcements
Learn how to migrate to Qlik Cloud Analytics™: On-Demand Briefing!
cancel
Showing results for 
Search instead for 
Did you mean: 
Srinivas
Creator
Creator

Ranking which based on variance

Hi All,

How will assign ranking with based on expression (Variance),  i have given rank below screen shot way. but i need reverse like please look into second screenshot.

.1.PNG

2.PNG

I need above way Please help me ASAP.

Advance Thanks,

Muna

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I don't think you can use the rank function to get the result you want. Try rank( sum(Qty)-sum(Sales),0,1). Perhaps the result of that is satisfactory. Otherwise you may have to calculate this in the script:

Date:

LOAD Date,

ID,

if(Sales<='500','30-Nov',

if(Sales>='500', '31-Oct')) as Monthend,

Year(Date) as Year,

Month(Date) as Month,

Qty,

Sales,

Sales-Qty as Variance

FROM (ooxml, embedded labels, table is Sheet1);

Result:

Noconcatenate

LOAD *, Autonumber(Variance) as Rank

Resident Result

Order by Variance;

Drop Table Date;


talk is cheap, supply exceeds demand

View solution in original post

4 Replies
Clever_Anjos
Employee
Employee

please try Num(Rank(TOTAL-(Column(2)-Column(1)),1))

Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

I don't think you can use the rank function to get the result you want. Try rank( sum(Qty)-sum(Sales),0,1). Perhaps the result of that is satisfactory. Otherwise you may have to calculate this in the script:

Date:

LOAD Date,

ID,

if(Sales<='500','30-Nov',

if(Sales>='500', '31-Oct')) as Monthend,

Year(Date) as Year,

Month(Date) as Month,

Qty,

Sales,

Sales-Qty as Variance

FROM (ooxml, embedded labels, table is Sheet1);

Result:

Noconcatenate

LOAD *, Autonumber(Variance) as Rank

Resident Result

Order by Variance;

Drop Table Date;


talk is cheap, supply exceeds demand
Srinivas
Creator
Creator
Author

Hi Gysbert,

As per your suggestion i did in back-end edit script level that is coming correct, can we do in front end at straight table level,

I need in front end level,

Advance Thanks,

Muna

jonathandienst
Partner - Champion III
Partner - Champion III

The suggestion from cleveranjos seems to work correctly:

=Num(Rank(TOTAL -(Column(2)-Column(1)),1))

This is the result in your table:

t1.png

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein