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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

aggr function: possible solution?

Hi guys,

I have a question which I believe can be solved using the aggr fucntion, but I'm a littlle unsure of how to apply. I have an expression:

(count ({$<ResponseText = {"Compliant"}>} ResponseText) + count ({$<ResponseText = {"Not applicable"}>} ResponseText)) / (count(System) *38)*100
I have a table in which I have a column listing all systems and the corresponding score arising from the expression noted above. I have also created another dimension in which if the score = 100, 'Yes', if score < 100, it returns 'No'.

However, i want to have a table which shows the number of '100 scored' systems within each unit. the problem when i replace system with unit in the table is that it takes a single figure average of all the system scores within that unit. so if 10 systems had a score of 100 and 10 had a score of 50 it would give a singular score of 75 for that unit. Is there a way in which i can count the number of systems in that unit that have a score of 100 using the aggr function?

I appreciate your help on this. thanks.

1 Solution

Accepted Solutions
lironbaram
Partner - Master III
Partner - Master III

hi,

you are right , you need to use aggr function

the expression should look like this

=sum(aggr(if(score=100,1,0),system))

i attached an example too.

hope it helps.

View solution in original post

5 Replies
Not applicable
Author

Hi

i'm not sure you need AGGR

why not sum( if ( score = 100 , 1 , 0 )) using Unit as dimension.

but maybe i don't understand the structure of your data. could you post a sample, if it doesn't work.

JJ

Not applicable
Author

Hi,

The problem is....when I try to do this, the average score of the whole unit is applied. So this may be 95% and therefore a 0 will be applied to the whole unit. What I require is, the score of each system to be taken into account within a table only displaying the unit.

Not applicable
Author

Just to make it clearer, can create a table like this:

UnitSystemScoreif(Score = 100, 1,0 )
A11001
A21001
A3980
A4980
A51001


If I remove System as a dimension and I add a sum(if(Score = 100, 1,0)), it takes an average of the scores i.e. (100+100+98+98+100)/5 and therefore returns 0 as a value where I would like it to be:

UnitSUM(if(Score = 100, 1,0 ))
A3


Any thoughts on how to achieve this?

I appreciate all help.

lironbaram
Partner - Master III
Partner - Master III

hi,

you are right , you need to use aggr function

the expression should look like this

=sum(aggr(if(score=100,1,0),system))

i attached an example too.

hope it helps.

Not applicable
Author

Great,

Thanks for the help, that sorted it out! 🙂