Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
mrbqlik2009
Contributor III
Contributor III

Calculate buying rank of customer in a product

Hi.

I have sample data in QlikView such as bellow:

LOAD * INLINE [

CustomerName, ProductTitle, Fee, Quantity, Price

A1,Book1,100,7,700

A1,Book2,200,5,1000

B1,Book1,100,3,300

B1,Book2,200,6,1200

C1,Book1,100,9,900

C1,Book2,200,9,1800

D1,Book1,100,4,400

D1,Book2,200,5,1000

E1,Book1,100,6,600

E1,Book2,200,6,1200

F1,Book1,100,12,1200

F1,Book2,200,9,1800

];


I want calculate rank of customer for a specific product.

for example:

Rank of customer "E1" in product "Book1" is 4.

Because:

F1 -> Book1 -> 1200

C1 -> Book1 -> 900

A1 -> Book1 -> 700

E1 -> Book1 -> 600

D1 -> Book1 -> 400

B1 -> Book1 -> 300

1 Solution

Accepted Solutions
shiveshsingh
Master
Master

As per input from Babaei, Criteria is price of the Product, grouped by Title and Customer.

If we take book1 price, then E will come at 4 rank.

View solution in original post

9 Replies
shiveshsingh
Master
Master

may be this

aggr(rank(sum(Price)) ,ProductTitle,CustomerName)

isingh30
Specialist
Specialist

Rank of customer "E1" in product "Book1" is 4?? What's the criteria for ranking?


Thank you!

shiveshsingh
Master
Master

As per input from Babaei, Criteria is price of the Product, grouped by Title and Customer.

If we take book1 price, then E will come at 4 rank.

isingh30
Specialist
Specialist

Thank you

shiveshsingh
Master
Master

Welcome

mrbqlik2009
Contributor III
Contributor III
Author

Thank you.

It solved.

just a question.

For some customer rank display for example 3-5, how can i display upper band. it means instead of 3-5 display 5?

mrbqlik2009
Contributor III
Contributor III
Author

Thank you.

It solved.

just a question.

For some customer rank display for example 3-5, how can i display lower band. it means instead of 3-5 display 3?

mrbqlik2009
Contributor III
Contributor III
Author

I solved that.

I should use this in rank function:

aggr(rank(sum(Price),0,1) ,ProductTitle,CustomerName)

shiveshsingh
Master
Master

You are a star Please close the thread