Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Irvin182
Contributor II
Contributor II

having trouble on selecting top 10 customer via button

Hi I need help, I'm working on button top 10 customers that will select in field Customer_No that's arrange in order descending [Total Scores] and descending [Total MSF].

the problem is I don't have any basis to get the total score and total msf to select the customer.

 

Qlikview Button.JPG

Thanks,

Irvin

1 Solution

Accepted Solutions
jaibau1993
Partner - Creator III
Partner - Creator III

Hi!

Beautiful problem 😁.

Try the following in "jaibau expression"

Rank(
MAX(ComplaitScore)+MAX(ContractScore)+MAX(FaultScore)+max(SalesIncident)
+
1/(
Rank(Sum({<CustomerID = {"=Rank(MAX(ComplaitScore)+MAX(ContractScore)+MAX(FaultScore)+max(SalesIncident),1) <= 10"}>} MSF_PHP)) + 1
)
,1) <= $(vTopCust)

Output:

solve.png

Greetings,

Jaime.

View solution in original post

13 Replies
tresesco
MVP
MVP

Try the below search string:

='=Rank(sum(MSF))<=10'

Irvin182
Contributor II
Contributor II
Author

thank you sir, but how about if you have a scenario like this you need to sort also total scoreQlikview Button.JPG

jaibau1993
Partner - Creator III
Partner - Creator III

Hi!

Use the following search string in your button action:

='("' & Concat(Aggr(
Only({<Customer_No = {"=Rank(Sum(MSF)) <= 10"}>} Customer_No)
,Customer_No
),'"|"') & '")'

Regards,

Jaime.

Irvin182
Contributor II
Contributor II
Author

hi Jaibau1993 in your expression can we add aggregate for the Total Score?

jaibau1993
Partner - Creator III
Partner - Creator III

Hi!

What do you actually mean 'add aggregate for the Total Score'? What is your desired output when pressing the button?

Jaime

jaibau1993
Partner - Creator III
Partner - Creator III

If you are looking for "the first ten customers sorting by Total Scores and MSF" then I think the following expression should work (not hard tested, maybe fails in some case):

='= Rank(MAX(ComplaintsScore)+MAX(ContractScore)+MAX(Faults)+max(IdentifiedRisk)) <=10 and Rank(Sum(MSF)) <= 10'

or

='("' & Concat(Aggr(
Only({<Customer_No = {"=Rank(Sum(MSF)) <= 10 and Rank(MAX(ComplaintsScore)+MAX(ContractScore)+MAX(Faults)+max(IdentifiedRisk)) <=10"}>} Customer_No)
,Customer_No
),'"|"') & '")'

Irvin182
Contributor II
Contributor II
Author

Hi Jaime, 

Here's the output i desired. The output should start with Total Score sort is descending then the Total MSF sort descending.

Customer_IDTotal_ScoreTotal_MSF
A1533,321,122.00
B151,213,231.00
C1521,222.00
D13323,222.00
E132,321.00
F7412,222.00
G713,123.00
H71,212.00
I6123,131.00
J6123.00
K441,444.00
L423.00
M212,313.00

 

Regards,

Irvin

jaibau1993
Partner - Creator III
Partner - Creator III

Hi!

Okey, I finally understood you. Try the following:

'=Rank(MAX(ComplaintsScore)+MAX(ContractScore)+MAX(Faults)+max(IdentifiedRisk)) <= 10 and rank(Sum({<Customer_ID = {"=Rank(MAX(ComplaintsScore)+MAX(ContractScore)+MAX(Faults)+max(IdentifiedRisk)) <= 10"}>} MSF)) <= 10'

It works with the example sample you provided!

Regards,

Jaime.

Irvin182
Contributor II
Contributor II
Author

Hi Jaime,

Thank you for the reply, I've tried the script and the result is this.

Capture.JPG

when i inseted 1-6 its ok, but when i inseted 7 and above it the sorting didn't work. 😞