Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Calculated Dimension: Selecting top 10 by value

Hello all,

I have a table with customer information and want to use the customer_name as a dimension in a line chart, generating a different line for each customer. Now I don't want all the customers to be in the dimension. Only my Top 10 customers by turnover. I have calculated the turnover per customer in the script so it is added to the customers-table. This gives these fields in the table: Customer_Number, Customer_Name, Customer_Turnover.

It has to be done in the front-end, because the selection of clients can change. If I select only 100 of the 1000 customers, I want the top ten of these 100, not of the 1000 customers.

I have tried as a calculated dimension using following expression: if(Customer_Turnover > FirstSortedValue(Customer_Turnover,Customer_Turnover,10),Customer_Name) but this only gives 'error in calculated dimension'. I have also tried with the Rank()-function but this didn't give me the required solution neither (again an error).

Does anyone have a solution for something like this?

Thanks in advance

2 Replies
Miguel_Angel_Baeyens

Hi,

Did you try using the tab "Dimension Limits" in the chart properties? Set it to restrict values showing only the 10 largest, according to the first expression.

If not, you will need an expression like the following:

=If(Aggr(Rank(Aggr(Sum(TurnOver), Customer_Name)), Customer_Name) > 0 AND Aggr(Rank(Aggr(Sum(TurnOver), Customer_Name)), Customer_Name) < 11

, FieldName)

Hope that helps.

Miguel

Not applicable
Author

u can also create a input variable for customer  and add the variable in Dimension limits to restirct the no of customers........ In input box if u select 10 you'll get a list of 10 customers.....