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

Counting within a field

I have a data set of trees. Each tree has a species (one of 500) and a condition (one of 7: good, poor, dead, etc.). I'm trying to make a stacked bar chart that shows, for each species, the proportion of trees with each of the conditions. For example,

tree 1: maple good

tree 2: maple poor

tree 3: maple good

tree 4: oak good

tree 4: oak poor

If I do something like: Count(Condition), I just get:

maple 3

oak 2

That is, it counts the number of trees of each species that have any value for condition (which is all of them). How can I show the results:

maple

   good 2

   poor 1

oak

   good 1

   poor 1

I'm really new to this, so grateful for any help.

1 Solution

Accepted Solutions
danansell42
Creator III
Creator III

Hi, add both Tree and condition as dimensions. Then add count(condition) as expression.

Display as stacked bar chart

Capture.PNG

View solution in original post

3 Replies
danansell42
Creator III
Creator III

Hi, add both Tree and condition as dimensions. Then add count(condition) as expression.

Display as stacked bar chart

Capture.PNG

devarasu07
Master II
Master II

Hi,

assume, you have data like this,

Data:

LOAD * INLINE [

F1,F2,F3

    tree 1,maple,good

    tree 2,maple,poor

    tree 3,maple,good

    tree 4,oak,good

    tree 4,oak,poor

];

Create pivot chart and create aggregate field like below,

Dimensions : F2 & F3

Measure: aggr(Count(F1),F2,F3)

Capture.JPG

Thanks,

Deva

Not applicable
Author

Thanks so much to you both! Both answers worked fine, but I realized I was a little unclear--the bar chart was just what I was looking for. Very grateful for the quick and thorough help.

~Kelaine