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: 
Not applicable

Set Analysis Within Aggr Functions

Hi guys,

I have a requirement from a customer in which we would like a table to be unaffected by any selection (basically going against Qlikview methodology!). The trouble I am having is that I can't seem to implement set analysis into my aggr function. I have created a simple(ish) example:

UnitABCD
Total20304050
Compliant1081210
Not Compliant10222840

We have units A,B,C,D and the corresponding total, number of complaint systems and number of not compliant systems within a unit. These calcs are created using aggr functions involving counting the number of compliant systems within a unit as follows:

=sum({$< Unit = >} aggr(if(Status = 'LtO Compliant',1,0),System))


Howvever if I now select, for example unit A, all the figures for the rest of the table return 0. Is there any way in which this can be overcome?

Thanks for the help.

6 Replies
Not applicable
Author

Hi there,

basically your set analysis should be based on "1" and not on "$", as you want to work on all the records as opposed to the current selection only.

Cheers, Lukas

Not applicable
Author

Thanks Lukas,

I changed my expression to :

=sum({1< Unit = >} aggr(if(Status = 'LtO Compliant',1,0),System))
but unfortunately it still produced the same results.

Not applicable
Author

Hi everyone,

Just wondering if anyone had some other ideas to this problem?

Any comments would be welcome,

Thanks

michael_anthony
Creator II
Creator II

I don't really use Aggr. My understanding was that you usually put an aggregation function within the Aggr function but you don't have one, just a 1 / 0 calculation.

But I'd suggest trying also putting the set extension {1<Unit = >} within the aggr function.

sum({1< Unit = >} aggr({1< Unit = >} if(Status = 'LtO Compliant',1,0),System))

May have to try some other placements, eg. within the If statement.
Not applicable
Author

Hi, could you perhaps post a sample QVW, that yould make things easier. Thanks.

Not applicable
Author

Hi,

Was this solved ... you could perhaps detach the table ... that will remove it from being included in selections I believe.