Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Highlighted
sharon_siao
New Contributor

Bar chart

I'm fairly new to Qlikview so please bear with me...

In a very simple world, let's say I have a bar chart to show total sales and total expenses, and I have a list box to choose a region (or not). If a region is selected, then the bar chart will show just total sales and total expenses for that region and if nothing is selected then I'd like the bar chart to show total sales and total expenses for the whole company. I don't really want to see all the regions in the chart. So in a way, I always want to see only two bars, one for total sales and one for total expenses. They could represent either the company or just one region.

Tags (1)
2 Solutions

Accepted Solutions
Partner
Partner

Re: Bar chart

Create the chart using 2 dimensions, one for company and one for region. 

Use a enable condition on the region dimension, IF(ISNULL(GetFieldSelections(region)),0,1). That will make the dimension only appear when a selection is made.

cbushey1
Contributor III

Re: Bar chart

Ok so I thought about this a little more and I think there is probably a simpler solution.

Why not just remove the dimensions all together and have the expressions do there calculations across the whole population (assuming you have 1 company in the data)? If you do this, then with no selections made you will have the totals you expect for the company and when you make a selection on a particular region, those calculations will change to be only for that region.

7 Replies
Partner
Partner

Re: Bar chart

Create the chart using 2 dimensions, one for company and one for region. 

Use a enable condition on the region dimension, IF(ISNULL(GetFieldSelections(region)),0,1). That will make the dimension only appear when a selection is made.

sharon_siao
New Contributor

Re: Bar chart

Thank you, this is indeed the way to go.

sharon_siao
New Contributor

Re: Bar chart

I have another question for Cbusheybd as what I'm seeing is probably related to the solution I implemented.

Now that I have done as you suggested, I see some quirky behavior. My chart is a bar chart (Subtype Grouped in Style). When I pick no region in filter, I see the company numbers correctly as Grouped, but when I pick a region, the chart becomes Stacked. Any idea? Thanks in advance.

cbushey1
Contributor III

Re: Bar chart

The chart subtype shouldn't be impacted by an enable condition on the dimension. 

Could you attach some screenshots of the chart and its properties so I can try to replicate?

sharon_siao
New Contributor

Re: Bar chart

Hi, I attached a word doc with screenshots. Let me know what you think. Or need to see anything else. Thanks

cbushey1
Contributor III

Re: Bar chart

Ok so I thought about this a little more and I think there is probably a simpler solution.

Why not just remove the dimensions all together and have the expressions do there calculations across the whole population (assuming you have 1 company in the data)? If you do this, then with no selections made you will have the totals you expect for the company and when you make a selection on a particular region, those calculations will change to be only for that region.

sharon_siao
New Contributor

Re: Bar chart

Yes! I was totally missing the forest for the trees. I had 'region' as a dimension, and then couldn't figure out how not to see all the data points for region dimension, so came here to post the original question. Your simple solution works just fine. Thanks again.