Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
amr_qlik
Contributor
Contributor

Creating a static top 10 bar chart

I've found a number of threads concerning this question, but my equation is somewhat more complicated so I'm not sure how to incorporate it in or if it is even possible.  My equation is below:

.2*count(distinct[Column 1])/Max({1} total Aggr(count(distinct {1} [Column 1]), [Category])) +

...repeat the above line 5 times with different columns being used for each.... +

if((count(distinct{$ <[Fiscal Year] = {$(=MAX([Fiscal Year]))}>}
[Product Number]) -count(distinct{$ <[Fiscal Year] = {$(=MIN(Fiscal Year]))}>}
[Product Number])) > 0, '0.08', '0')

Thank you for the help

Labels (3)
4 Replies
Or
MVP
MVP

Could you try and clarify what exactly is preventing you from getting the top 10 as it stands? Is using the dimension Top 10 setting not working here? That should, in theory, work independently of whatever your formula happens to be, unless I'm misunderstanding the question.

amr_qlik
Contributor
Contributor
Author

Yes, so I can create the chart without a problem.  My issue is that once I use a filter, it filters the chart.  I'd like the top 10 to remain regardless of the filter(s) in use.

Or
MVP
MVP

You would presumably need to add {1} to each aggregation function in the formula, since at the moment some of your functions are not scoped to the entire dataset, e.g the first part count(distinct [Column 1]) will only count Column 1 within your selections (and within any chart dimensions). You may also need to rephrase your last if() section so that it is contained within an aggregation function (otherwise that part will also not ignore selections), I'm not quite sure what it's doing and how that fits within your data structure. In that scenario it will probably be necessary to use an external Only() and wrap the inner parts in an aggr() to avoid nested aggregation formulas.

amr_qlik
Contributor
Contributor
Author

Adding the {1} to each of the earlier pieces of my function worked.  Now I'm just trying to figure out the final if statement.    In case you need to know, that last statement is checking to see if there is more of a certain product on the latest fiscal year than there was in the earliest fiscal year, and then selects the appropriate value based on that.  As you suggested, I tried wrapping the if statement in an only() and then used an aggr() on the inner parts.  This does prevent nested aggregation issues but also doesn't get my bar chart to work properly.