So I have data, and I want to count the labels:
Attribute Labels
A Man, kind
B Girl, kind
C Man, bad
D Man
E Girl
I already put the data in Qlik Sense and created a pie chart based on labels, resulting in : Man, kind = 1; girl ,kind = 1; man, bad = 1; man = 1; girl = 1
But it isn't the expected result I want. The expected result I want is: Man = 3 , girl = 2, kind =2 , bad = 2
. After that I will create a pie chart from the result.
How can I achieve this?
You need to use SubField to split Labels per delimiter. You can also add 1 as #number
so then is easier do just SUM(#number)
in any chart.
You haven't included your code so I tested solution using INLINE load
with your data and it is working fine.
[table]:
LOAD
Attribute,
SubField(Labels,', ') as Labels,
1 as #number;
LOAD * INLINE [
Attribute, Labels
A, "Man, kind"
B, "Girl, kind"
C, "Man, bad"
D, "Man"
E, "Girl"
];
result: