Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Avg Multiple conditions in chart and script

Hello, I'm having trouble with the syntax to avg multiple values.

I have the below values and I want to exclude VTO and UTPO values in my avg expression. I would like to see both in chart and in script...Thanks in advance.

Reasons

OT

PTO

VTO

UTPO

=avg(if(REASON = '',''))

1 Solution

Accepted Solutions
sunny_talwar

May be this:

=Avg({<REASON -= {'VTO', 'UTPO'}>} FieldName)

or

=Avg({<REASON ={'*'}-{'VTO', 'UTPO'}>} FieldName)

View solution in original post

8 Replies
sunny_talwar

May be this:

=Avg({<REASON -= {'VTO', 'UTPO'}>} FieldName)

or

=Avg({<REASON ={'*'}-{'VTO', 'UTPO'}>} FieldName)

krishnacbe
Partner - Specialist III
Partner - Specialist III

Hi,

Can you please share some more details and add some sample app/output you are expecting.

Anonymous
Not applicable
Author

What would the FieldName be in my case?

sunny_talwar

Whatever you are trying to Avg

Anonymous
Not applicable
Author

I have a column "Reasons" that has about 30 values within that column. I want to avg only certain values within the Reasons column.

Column                                                      

Reasons                                                ID (thds of values)                   Value

OT (include in AVG)                               1                                              10

PTO (include in AVG)                            2                                                20

VTO (exclude in AVG)                           3                                               30

UTPO (exclude in AVG)                         4                                              40

Output

AvgReasons

krishnacbe
Partner - Specialist III
Partner - Specialist III

Hi,

Use below expression.

=Avg({<REASON -= {'VTO', 'UTPO'}>} Value)

Anonymous
Not applicable
Author

Got it! One more question

I have two conditions that I need met. The 2nd, Status = Closed. Can that be added in the expression?

=Avg({<DISCHARGE_REASON ={'','','','','',''}>}DAYS)

sunny_talwar

May be this:

=Avg({<REASON -= {'VTO', 'UTPO'}, Status = {'Closed'}>} Days)