Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
mrjohn23
Creator III
Creator III

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)

View solution in original post

krishnacbe
Partner
Partner

Hi,

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

mrjohn23
Creator III
Creator III

What would the FieldName be in my case?

sunny_talwar

Whatever you are trying to Avg

mrjohn23
Creator III
Creator III

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
Partner

Hi,

Use below expression.

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

mrjohn23
Creator III
Creator III

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)