Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sharon_siao
Contributor III
Contributor III

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.

2 Solutions

Accepted Solutions
cbusheybd
Partner - Contributor II
Partner - Contributor II

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.

View solution in original post

cbushey1
Creator III
Creator III

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.

View solution in original post

7 Replies
cbusheybd
Partner - Contributor II
Partner - Contributor II

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
Contributor III
Contributor III
Author

Thank you, this is indeed the way to go.

sharon_siao
Contributor III
Contributor III
Author

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
Creator III
Creator III

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
Contributor III
Contributor III
Author

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

cbushey1
Creator III
Creator III

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
Contributor III
Contributor III
Author

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.