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: 
CB308
Contributor III
Contributor III

Display Total of Top 5 Customers and other data

Hi,

I have a chart that shows the following:

StoreValueRank
17451
25802
35603
45504
55255
65156
74907
84808
94009
1039010
Total5235


I would like to display in a combo chart the following from the above data:

Top 5 Stores - Value $2,960

Average of All Stores - $524

Value for individual store selected for comparrison (store 9) $400

Can this be done and if so, any assistance would be much appreciated.

1 Solution

Accepted Solutions
pover
Luminary Alumni
Luminary Alumni

Here are the expression with some modifications:

sum({$<Store={"=rank(total sum({$<Store=>} Value))<=5"}>} Value)

avg(aggr(sum({$<Store=>} Value),Store))

The Store= should ignore the selection of one store.

Regards.

View solution in original post

6 Replies
pover
Luminary Alumni
Luminary Alumni

The combo chart would have 3 expressions.

The first would be something like this:

sum({$<Store={"=rank(sum(Value))<=5"}>} Value)

avg(aggr(sum({$<Store=}>} Value),Store))

sum(Value)

Regards.

CB308
Contributor III
Contributor III
Author

thanks for your prompt response!

for the second expression, avg(aggr(sum({$<Store=}>} Value),Store)). I am receiving the error code.... error in expression

When I use your first and third expression and select "one store", only the third expression displays

any thoughts?



pover
Luminary Alumni
Luminary Alumni

Here are the expression with some modifications:

sum({$<Store={"=rank(total sum({$<Store=>} Value))<=5"}>} Value)

avg(aggr(sum({$<Store=>} Value),Store))

The Store= should ignore the selection of one store.

Regards.

CB308
Contributor III
Contributor III
Author

Awesome! thanks so much...

If I wanted the average of all stores regardless of when selecting only my store, what would that calculation be?

Sorry, I'm new to set analysis.

avg(aggr(sum({$<Store=>} Value),Store))

pover
Luminary Alumni
Luminary Alumni

It can be a little confusing because each nested function has its own set analysis. Try this expression.

avg({$<Store=>} aggr({$<Store=>} sum({$<Store=>} Value),Store))

Regards.

CB308
Contributor III
Contributor III
Author

worked perfectly!

thank you for your time!!!!