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: 
QlikSensor
Partner - Creator
Partner - Creator

Stacked Bar Diagram

Hi, I want to have a stacked bar diagram and have following field: VALUE which contains e.g. those values [1, 4, 5, 7, 9, 10, 13]

I want to count the values <5, the values between >=5 and <10 and the values >= 10, which means three stacked bars: the first one counts 2, the third counts 2 values.

I tried several things but didn't manage to find the fitting measure. Any help?

 

Labels (3)
4 Replies
HeshamKhja1
Partner - Creator II
Partner - Creator II

I expect the best way is to create a bucket field in the backend (load editor).

LOAD
	VALUES,
    If(VALUES <= 5, '<=5',
    If(VALUES > 5 AND VALUES < 10, '(5, 10)',
    If(VALUES > 10, '>10', 'Others'))) AS VALUES_BUCKET;

Then in your bar chart use it as the dimension and count the rows Count(VALUES) in the measure.

HeshamKhja1
Partner - Creator II
Partner - Creator II

I just had another idea that might be easier and more suitable for your scenario.

Put the dimension: '1'

Put 3 measures:

Count( {<VALUES = {"<5"}>} VALUES)
Count( {<VALUES = {">5<10"}>} VALUES)
Count( {<VALUES = {">=10"}>} VALUES)

 

Make the chart stacked.

HeshamKhja1
Partner - Creator II
Partner - Creator II

@QlikSensor were you able to achieve what you wanted?

Aasir
Creator III
Creator III

1. Create a new bar chart in Qlik Sense with VALUE on the x-axis.

2. You'll need three measures, one for each category:

    • Measure 1 - Count values <5:

      Count({<VALUE = {"<5"}>} VALUE)
    • Measure 2 - Count values >=5 and <10:

      Count({<VALUE = {">=5<10"}>} VALUE)
    • Measure 3 - Count values >=10:

      Count({<VALUE = {">=10"}>} VALUE)

    These expressions use set analysis to count the values that meet the specified conditions within each category.

  1. 3. In the bar chart properties, stack the measures on top of each other in the 'Data' tab. You can choose the measures for each category, and the bars will be stacked accordingly.