Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Changing the columns of a bar chart

Hi,

I would like to know if it is possible to keep the columns of a bar chart dynamic.  If I have 20 products, and I just want to show 5 products in a bar chart with respect to their performance, it it possible (Rather than keeping the bar chart static)??

So, during month one, if products 1, 2, 3, 4 and 5 have the highest sales, they will be shown in the bar chart and during month 2, if Products 2,3,5,8 and 9 have the highest sales, they will be displayed on the bar chart.


Thanks and regards,


Sunil

1 Solution

Accepted Solutions
swuehl
MVP
MVP

Try something like this as sort expression in sort tab:

=if(Product='ProductName1', -count(total Product),if(Produc='ProductName2', count(total Product), rank(sum(Sales) )))

This should order your Products

ProductName1, {list of 5 Products ordered by sum(Sales)}, ProductName2

View solution in original post

7 Replies
swuehl
MVP
MVP

This should be no problem.

I assume you have a chart with dimension product and as expression a sum of sales or similar.

Using QV11, you could use dimension limits for this.

Check the 'Restrict which values are displayed...' check box and then first option 'Show only largest 5 values'

(Uncheck Others at the bottom part if needed)

If you are using QV10, you could sort by y-value descending and limit the number of values shown in presentation tab to 5.

Hope this helps,

Stefan

Not applicable
Author

Is it possible to keep one or two values static and keep the others dynamic?  So in reference to the example I provided, I might want to keep Product 1 and Product 2 in the bar chart and might want to keep the other three products based on their sales.  Is that possible at all?

Regards,


Sunil

swuehl
MVP
MVP

You could try something like this:

Create a bar chart with a calculated dimension like

=aggr(if(rank(sum(Sales))<=5 or match(Product,'ProductName1',ProductName'2'),Product),Product)

and check suppress when value is null in dimension tab. Your expression is sum(Sales) or similar.

Not applicable
Author

but how can I change the order of the columns?

swuehl
MVP
MVP

Which order do you want? You could try using an expression in sort tab.

Not applicable
Author

in the sense, I want two products to remain at the ends and in between, i want to change the ordering of the products based on sales.

swuehl
MVP
MVP

Try something like this as sort expression in sort tab:

=if(Product='ProductName1', -count(total Product),if(Produc='ProductName2', count(total Product), rank(sum(Sales) )))

This should order your Products

ProductName1, {list of 5 Products ordered by sum(Sales)}, ProductName2