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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
PGeorge
Contributor III
Contributor III

Ignore Selections using set analysis

Hello,

I have created the below expression in a bar chart measure and the set analysis ignoring the "HospitalName" doesn't seem to work. Even when I replace {$<[HospitalName]=>} with {1} my selections are still taken into account. In other  charts, I have created simpler expressions using the above set analysis and it works as expected. Is there something i am missing here?

=Aggr(Count({$<[HospitalName]=>} if((HandHygieneRecordsMapped.Action = 0 OR HandHygieneRecordsMapped.Action = 1) ,[HandHygieneRecordsMapped.Id])), [HospitalName])/Aggr(Count({$<[HospitalName]=>} [HandHygieneRecordsMapped.Id]), [HospitalName])

 

Thanks .

Labels (2)
1 Solution

Accepted Solutions
MayilVahanan

Hi

Try like below

Count({$<[HospitalName]=,HandHygieneRecordsMapped.Action={0}>+<[HospitalName]=,HandHygieneRecordsMapped.Action={1}>}[HandHygieneRecordsMapped.Id])
/
Count({$<[HospitalName]=>}[HandHygieneRecordsMapped.Id])

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.

View solution in original post

10 Replies
Chanty4u
MVP
MVP

Modify like below 

Aggr(

    Count({<HospitalName>} 

        If(

            HandHygieneRecordsMapped.Action = 0 OR HandHygieneRecordsMapped.Action = 1,

            HandHygieneRecordsMapped.Id

        )

    ),

    HospitalName

) / Aggr(

    Count({<HospitalName>} HandHygieneRecordsMapped.Id),

    HospitalName)

BrunPierre
Partner - Master II
Partner - Master II

Hi @PGeorge , How about this?

Count({$<[HospitalName]=,HandHygieneRecordsMapped.Action=0}>+<HandHygieneRecordsMapped.Action={1}>}[HandHygieneRecordsMapped.Id])
/
Count({$<[HospitalName]=>}[HandHygieneRecordsMapped.Id])
PGeorge
Contributor III
Contributor III
Author

Hello ,

Unfortunately, the results I get using the expression you shared are the same as mine.

The HospitalName is not ignored in my selections.

 

PGeorge
Contributor III
Contributor III
Author

Hi BrunPierre,

The expression has an error in set modifier, so it doesn't give any results.

BrunPierre
Partner - Master II
Partner - Master II

Missing a curly bracket, retry.

Count({$<[HospitalName]=,HandHygieneRecordsMapped.Action={0}>+<HandHygieneRecordsMapped.Action={1}>}[HandHygieneRecordsMapped.Id])
/
Count({$<[HospitalName]=>}[HandHygieneRecordsMapped.Id])

PGeorge
Contributor III
Contributor III
Author

Thanks for your prompt answer.

The expression is valid now, when I select a HospitalName the chart doesn't filter out the selected HospitalName but it falsely recalculates the chart figures as shown below.

ExpectedNoFilter.PNG

FilteredResult.PNG

MayilVahanan

Hi

Try like below

Count({$<[HospitalName]=,HandHygieneRecordsMapped.Action={0}>+<[HospitalName]=,HandHygieneRecordsMapped.Action={1}>}[HandHygieneRecordsMapped.Id])
/
Count({$<[HospitalName]=>}[HandHygieneRecordsMapped.Id])

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
BrunPierre
Partner - Master II
Partner - Master II

Assuming your original expression works fine except for the filter, here is a modified set.

Count({<[HospitalName]>} Aggr(Count({$<[HospitalName]=,HandHygieneRecordsMapped.Action={0}>+<HandHygieneRecordsMapped.Action={1}>}[HandHygieneRecordsMapped.Id]),[HospitalName]))
/
Count({<[HospitalName]>} Aggr(Count({$<[HospitalName]=>}[HandHygieneRecordsMapped.Id]),[HospitalName]))

PGeorge
Contributor III
Contributor III
Author

Hi  

Your approach is working as expected. 

Could you please ellaborate on the syntax of the above expression which effectively ignores the HospitalName selection, or provide a documentation link (if there is any) where I could get more info? 

Also, when i try to get the Median for the chart using the expression you provided i get "Nested aggregation not allowed" error. Is there a way to tackle it using the same expression?

Thanks.