Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

i am doing top n customer analysis based on the company and purchase .

i am writing a condition as

=IF (AGGR(RANK( SUM(Amount) , Sum(Quantity),[Customer Code] )<= vCustomerCount ,[Customer Name] )

where vCustomerCount is a variable which is set by a slider containing this variable,

where i set this variable as vCustomerCount=Count([Customer Code])

But error in calculation is comming.

Help me,

Thanks and Regards,

5 Replies
Not applicable
Author

Instead of doing this, put expression directly. Sort table on Expression and put vCustomerCount in limit dimesions/ Show only vCustomerCount rows.

Not applicable
Author

Hello Swapnil,

     Can u please provide me some sample file for this,

Not applicable
Author

Give me your file with few records. I will do and return to u.

mbm
Employee
Employee

Nurpur,

Assuming you were looking to rank top 10 sales people using Sum(Amount * Quantity), I have attached example which shows your top 10 sales people by revenue using both a calculated dimension, as well as using dimension limits.

Dimension limits are certainly preferable to using a calculated dimension in this case, and I would recommend that you calculate the revenue value (Quantity * Amount) in the load script rather than in the expression.

mbm
Employee
Employee

Updated to show dimension limit using variable, as well as removing the Amount * Quantity calculation which is already performed on SaleAmount field in my data model.

Another change is to update the chart with dimension limit to show a total which is the sum of rows and not the expression total. In this way you only see the total for the top 10 Sales people