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

How to determine when the value of another field equals to the aggregated field

Hi experts,

Now I have two fields, for simplicity let's call them fieldA and fieldB. See the example below. Both fields have the same distinct values (in this example both type1 and type2).

idfieldAfieldB
001type1type1
002type2type2
003type1 
004type1 
005type2type1

 

My goal is to draw a bar chart, with x-axis being the distinct values in fieldA and y-axis being count in fieldA . Certainly I can use a simple aggregation function aggr(count(id),fieldA). However, because my filter pane is using fieldB as filtering dimension (because fieldB is used to build association with other tables), I would like my x-axis being fieldB. Would appreciate your help on how can I achieve this? Maybe some set analysis using aggr(count({<some set analysis>} id),fieldB)?

The desired output:

fieldAcount
type13
type22
Labels (2)
1 Reply
chaorenzhu
Creator II
Creator II
Author

I figured it out... it's not possible to aggregate on fieldB and expect my desired output as it will only group by based on values in fieldB. To achieve my expected result I went back to the data model and create a subset table with id and fieldA loaded as fieldB, then I'm able to use fieldB as common field for association