Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

grouped and stacked bar charts issues

Hey all,
I try to realize a flexible grouped and stacked bar chart. The main aspect is to show data of different people in two dimensions. First dimension is the year and second a category. The data should be stacked and grouped at the same time. Until now I got all this done and it works quite fine, but I also would like to get some flexibility in changing the apperance of the bar chart by selecting combinations.
Following table is my data source.
yearcategoryPeterPaulTobias
2014A20126
2014B5163
2015A81011
2015B45317
2016
A0813
2016B21418
In the load script I simply loaded this table and created a combination of year and category.
data:
LOAD year,
      c
ategory,
     
Peter,
     
Paul,
     
Tobias,
     
year &'-'& category as combination
FROM
sample_data.xlsx
(
ooxml, embedded labels, table is Tabble1);
The bar chart result works as defined:
bar-chart-normal.png
But when I want to display data in a flexible way I stand in front of a big problem. How can I disable the display of the empty dimensions? The result just should display year 2014 with category A & B, year 2015 only with category B, and year 2016 only with categroy A. So the "empty" dimension should disappear.
flexible.png
I tried to write some if-functions in the dimensions area. So something like if(sum of data in this dimension is <= 0, 0, year). But it didn't work out ...
Thanks for reply!
BR
Henrik
6 Replies
Gysbert_Wassenaar

You can't if you want to use two dimensions for the x-axis. You can try using a calculated dimension that concatenates the Year and Category dimensions: = Year & ' - ' & Category.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks for your reply, but if I do  what you suggested I lose the "grouped" feature ... and I definetly need to display as groups. Isn't there any other possibility? I am also in the situation that I can change the structure of my data source, so the most important is that I can realize the shown bar format. Any ideas someone?

Not applicable
Author

HI,

You can simply go to chart properties and under the dimension tab just select the check box displaying 'Suppress when value is null '

Hope it works

Not applicable
Author

that was the first thing I tried, but unfortunately it doesn't work

Not applicable
Author

Does really no one see a solution for my problem? I am still struggeling with that. And again I am 100% flexible with the table structure!!! I just need to realise the diagram results.

Thanks for reply!

Gysbert_Wassenaar

You want the grouped feature, but you don't want it to act like the grouped feature. Well, that's simply not possible. If you use two dimensions on the same axis then space is reserved for each dimension value (A and B in your example) even if no data is available.


talk is cheap, supply exceeds demand