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

Count doesn´t work with expression

Hi,

I´m trying to do a count of an expression. The count and expression look like this:

 

Count

(
(
if(Minimum='NA' or
Sum(Maximum)-
Avg(TotalSample)<=
Avg(TotalSample)-
Sum(Minimum),
Sum(Maximum)-
Avg(TotalSample),
Avg(TotalSample)-
Sum(Minimum))
/3/
Stdev(TotalSample

))>=(133/100))

Does anybody know how I´m supposed to do this count in order for it to pase and work!?

Thank!

Marita

1 Reply
swuehl
MVP
MVP

You can't embed an aggregation function into another (sum or avg into count), you need to use advanced aggregation to do something like this (check the aggr() function for more details).

The exact syntax is depending on the dimensions you want to use for the advanced aggregations, but it will look maybe like

Count

(

aggr

(

if(Minimum='NA' or (Sum(Maximum)-Avg(TotalSample) )<= (Avg(TotalSample)-Sum(Minimum)) ,
Sum(Maximum)-Avg(TotalSample),
Avg(TotalSample)-Sum(Minimum) )
/3/
Stdev(TotalSample)

, AGGRDIM1, AGGRDIM2

) )