Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
swiftfahad
Contributor III
Contributor III

Rank client on the basis of calendar input

Respected Grus.

I am using following expression to show top view of different channels (client)

=sum({$<CHANNEL_NAME={"rank(aggr(sum(AMOUNT),CHANNEL_NAME))<=$(V_ctop)"}>}AMOUNT)

In above expression V_ctop is input value coming from user (i.e. 2,3,4,5....).

Now I want user to also select TO and FROM date from calendar and storing in variables V_frmdte and V_todte respectively.

Say user want to see the top 5 channel w.r.t AMOUNT where invoice_date lies between 01-Jan-2017 to 31-Jul-2017 (stored in variables)

plz advice me how to include dates variables in above expression.

1 Solution

Accepted Solutions
sunny_talwar

Is this working for you?

=Sum({$<CHANNEL_NAME={"rank(aggr(sum(AMOUNT),CHANNEL_NAME))<=$(V_ctop)"}>}AMOUNT)

I would think not because you are missing an equal sign

=Sum({$<CHANNEL_NAME={"=rank(aggr(sum(AMOUNT),CHANNEL_NAME))<=$(V_ctop)"}>}AMOUNT)

Anyways, to answer your question, may be you need this

=Sum({$<CHANNEL_NAME={"=Rank(aggr(sum({<Date = {'>=$(=V_frmdte)<=$(=V_todte)'}>}AMOUNT),CHANNEL_NAME))<=$(V_ctop)"}, Date = {'>=$(=V_frmdte)<=$(=V_todte)'}>}AMOUNT)

View solution in original post

3 Replies
sunny_talwar

Is this working for you?

=Sum({$<CHANNEL_NAME={"rank(aggr(sum(AMOUNT),CHANNEL_NAME))<=$(V_ctop)"}>}AMOUNT)

I would think not because you are missing an equal sign

=Sum({$<CHANNEL_NAME={"=rank(aggr(sum(AMOUNT),CHANNEL_NAME))<=$(V_ctop)"}>}AMOUNT)

Anyways, to answer your question, may be you need this

=Sum({$<CHANNEL_NAME={"=Rank(aggr(sum({<Date = {'>=$(=V_frmdte)<=$(=V_todte)'}>}AMOUNT),CHANNEL_NAME))<=$(V_ctop)"}, Date = {'>=$(=V_frmdte)<=$(=V_todte)'}>}AMOUNT)

swiftfahad
Contributor III
Contributor III
Author

hi Sunny!!

Ya you were right '=' was typing mistake its actually there in my doc.

and so many thanks for your reply this is exactly I want...

cheers!!!

Anil_Babu_Samineni

You can close the thread Qlik Community Tip: Marking Replies as Correct or Helpful

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful