Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

function in function in set analysis

Hello friends

I want to count rows that avg(A-B)<=0 with set analysis like bellow:

count({<Avg(A-B)={"<=0"}>} Avg(A-B))

Please correct my expression

Thanks

5 Replies
swuehl
MVP
MVP

Average is an aggregation function, and I am unclear how you want to use this on a record base.

In general, you need a field name, no function allowed, left from the equal sign in a set modifier.

I am still unclear what you are trying to achieve, so please post some sample data records and your expected outcome.

Anonymous
Not applicable
Author

SO how i can write my instruction

i wanna get average of column and count rows if their average are less than zero

‌thank you swuehl for help

petter
Partner - Champion III
Partner - Champion III

=Sum( Aggr( -(Avg(A-B)<0) , Group ) )

Group is the dimension that you want an average for. The comparison Avg(A-B)<0 will return -1 or 0 for true or false and the -1 we can invert the sign so we get a 1 which is easy to do a Sum which is essentially then a count...

petter
Partner - Champion III
Partner - Champion III

Here is a demo:

Anonymous
Not applicable
Author

Hi Petter! Thanks for taking time to answer.