Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
yossi_bire
Contributor II
Contributor II

Set Analysis based on Rank

Hi,

I'm struggling with this issue for several days.

I want to calculate the Total value of the N customers with the same conditions.

Meaning, first calculate the total sale per Customer with some conditions (set analysis), then rank them, and finally sum the total sales for the first N top customer. the N is a variable the can be changed by the user.

somthing like this

sum(<{Field1={''},field2={''}, Customer = { Rank( sum(< {Field1={''},field2={''} > Sales } <= $(NTopCustomer))} Sales)

thanks

15 Replies
yossi_bire
Contributor II
Contributor II
Author

By the way, i'm using it in other Set Analysis and it's working perfectly. only inside the Rank it's giving a null result

sunny_talwar

Not sure, would you be able to share a sample to check this out?

yossi_bire
Contributor II
Contributor II
Author

i cant export an app from our servers.

what information do you need in order to help me?

sunny_talwar

Well I am not sure what might be going on which is why I ask to see the app. I am not sure if I will be able to know what the issue might be without looking. May be someone else can help.

yossi_bire
Contributor II
Contributor II
Author

I figured out the problem. Apparently, the set analysis condition in a Rank function can't be greater than or less then it works only with "=" 

so I created an if statement and change the condition for each case.

 

for example, if the user selected a 2 years view, meaning 8 quarters, the set analysis set to [Date.autocalender.QuartersAgo]={0,1,2,3,4,5,6,7,8}

and if the user selected a 1-year view the condition was set to [Date.autocalender.QuartersAgo]={0,1,2,3,4]

 

but thanks for the 95% of the solution

ccsimo16
Contributor III
Contributor III

Hi Sunny

I am trying to rank customer for this year by their turnover, using 

Sum(
[Calendar Year] = {'$(vCurrentYear)'}
[Customer Holding Name] = {"=Rank(Sum(
{<
[Calendar Year] = {'$(vCurrentYear)'}
>}
[Sales Turnover Net]))
<= 10"}
>}
[Sales Turnover Net])

but no values are appearing.