Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Limit totals in a chart by a variable

Hi,

I have a chart that displays a list of my top customers. This is adjusted by a slider that has a variable vTopN. It all works fine except the actual total is a sum of all customers and not what I set my slider to i.e. I set the slider to 5 - it shows me only 5 customers and there sales but the total is still the total of all customers. I have searched the site for a answer but do not know enough about codeing to work it out myself. I have tried certain sugestions i have seen in the forums like set the expression total to Sum of rows, but my total still remained of all customers.

My current expression is:

sum({$<Transaction={'Bills'}, Ledger={'Actuals'}, Year={$(=Max(Year))}, Quarter=, Month=, Week=, Day=, Date=>}[Billed Net Value])



Please help...





1 Solution

Accepted Solutions
Not applicable
Author

Hi Steve,

Here you are two possible solutions.

See attached. (there are two tables with the solution)

I hope it helps you.

Regards.

View solution in original post

13 Replies
Not applicable
Author

do you can upload the qvw for more detail about the graph and the variable?

Not applicable
Author

Please find variable issue 050810 attached

mike_garcia
Specialist
Specialist

Qvw requires user and password.

Miguel García
Qlik Expert, Author and Trainer
Not applicable
Author

Hi, sorry this is the first time I am uploading something. I think it should be ok. I had hidden script with section access. I have removed this. I hope it open ok now.

Not applicable
Author

Hi,

you need to recompile after erase the section access.

Not applicable
Author

Done

Not applicable
Author

Hi,

You just show the rows (5 rows, 10 rows), but the expression was calculated for all.

So you need to put a condition into your expression and wiil be work fine!


= if(rowno() <= $(vTopN),
num(sum({$<Transaction={'Bills'}....

Not applicable
Author

Hi Everyone

Thank you very much for the assistance and the answer from Eduardo, I really appreciate the time and effort taken to help me with this issue.

Not applicable
Author

Hi,

There is still one issue. The code Eduardo gave me above does indeed limit the results to what the slider is set at i.e. 5 customers, but it seems to take the first 5 customers in the table instead of taking the Top five customers. So I have this list where the sales manager wants to see his top performing customers, by default I set the slider to 5 but it needs to be adjustable, does anyone know the final piece here so I can get the result required?