Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
agg
Contributor II
Contributor II

Counting measures

Hi,

I'm pretty new with QlikSense and I've been struggling with a pi chart for a few days. Probably it's easy to solve, but I haven't been able to find a proper solution.

Let's assume we have different Incident Families named A, B, C, D and so on. My dimension is Incident Families and my measure  is how many incidents belonging to each family have been reported. So I could do a count(). My problem is A, B, C have a similar criteria to count them Count(IdTable = {'14'}, IdItem = {'1','11'})Incidents. However, D have a totally different criteria to count them Count(IdTable = {'19'}, IdDepartment = {'C'})Incidents

I've been trying to solve it by using IF statements, but it doesn't seem to work.

Any suggestion?

Thanks in advance

1 Solution

Accepted Solutions
agg
Contributor II
Contributor II
Author

Thanks for your reply.

It seems to work eventhough I don't get the expected values. I'll check my data to find the mistake.

Thanks!

View solution in original post

5 Replies
pradosh_thakur
Master II
Master II

pick(match(Incidents,'D')+1,Count({<IdTable = {14}, IdItem = {1,11}>}Incidents ),Count({<IdTable = {19}, IdDepartment = {'C'}}>}Incidents ))
Learning never stops.
pradosh_thakur
Master II
Master II

Count({<IdTable = {14}, Incidents = {'A','B','C'} ,IdItem = {1,11}>}Incidents )+Count({<IdTable = {19}, Incidents = {'D'}, IdDepartment = {'C'}}>}Incidents )

 

Learning never stops.
tresesco
MVP
MVP

Different calculation logic for different dimension members make the expression complex and sometime even not feasible. Expression structure could be like:


If(Match([Incident Families], 'A', 'B', 'C'),
Count({<IdTable={14}, IdItem={1,11}>} Incidents),
Count({<IdTable={19}, IdDepartment={'C'}>} Incidents)
)

agg
Contributor II
Contributor II
Author

Thanks for your reply.

Your solutions is very similar to what I already tried and it doesn't seem to work as it's only one branch of the IF statement (I can't understand why).  It counts correctly all families but 'D'. If I change conditions, it counts properly 'D' but not A,B,C, ...

Thanks again for your help.

agg
Contributor II
Contributor II
Author

Thanks for your reply.

It seems to work eventhough I don't get the expected values. I'll check my data to find the mistake.

Thanks!