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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

AVG WITH MANY EXPRESSIONS

Hy,

I´m using this variable

V_Contagem_Tempo=if(TEMPO_PROCESSO.CD_TIPO_TEMPO_PROCESSO=30,'CHAMADA','ATENDIMENTO')

In the expression of a chart I do this expression

=







IF(V_Contagem_Tempo='CHAMADA', MIN(TEMPO_PROCESSO.DH_PROCESSO)-ATENDIME.DH_PRE_ATENDIMENTO_FIM, MIN(PREST_USER_DOCUMENTOS.DT_REGISTRO_DOC)-ATENDIME.DH_PRE_ATENDIMENTO_FIM)

How can I put an AVG function with this expression

AVG(MIN(TEMPO_PROCESSO.DH_PROCESSO)-ATENDIME.DH_PRE_ATENDIMENTO_FIM, MIN)



DON´T WORK....

Any Idea?

Thanks for the help.

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

Thank you... but don´t work...

I´m not using a range of values.

I´m using a conditional expression.

But if you help me to do a AVG with the expression bellow it´s fine.

MIN

(PREST_USER_DOCUMENTOS.DT_REGISTRO_DOC)-ATENDIME.DH_PRE_ATENDIMENTO_FIM)

Sorry for my english.....

Thanks





View solution in original post

9 Replies
martin59
Specialist II
Specialist II

Hi,

Is that you want :

rangeavg(MIN(TEMPO_PROCESSO.DH_PROCESSO)-ATENDIME.DH_PRE_ATENDIMENTO_FIM,MIN(PREST_USER_DOCUMENTOS.DT_REGISTRO_DOC)-ATENDIME.DH_PRE_ATENDIMENTO_FIM))


Not applicable
Author

Thank you... but don´t work...

I´m not using a range of values.

I´m using a conditional expression.

But if you help me to do a AVG with the expression bellow it´s fine.

MIN

(PREST_USER_DOCUMENTOS.DT_REGISTRO_DOC)-ATENDIME.DH_PRE_ATENDIMENTO_FIM)

Sorry for my english.....

Thanks





martin59
Specialist II
Specialist II

are you using a straight table ?

Not applicable
Author

No, i´m using a gauge chart.

martin59
Specialist II
Specialist II

I don't understand what you want, why do you want to do an avg if you do a min ?

if you really want to do an avg, you must have a dimension that you have to use with aggr() function like this :

avg(aggr(YourExpression, Dimension))


Not applicable
Author

Let me explain..

I have a select that bring´s me this

cd_triag, cd_document, dh_document

1:n

But in a lot of times the same cd_atend have a lot of documents (this is ok)

I have another table that contains

cd_atend, dh_atend

1:1

I need to calculate de time between the first document by dh(date hour) of document and the dh(data hour) atend for this I use.

min(dh_document) - dh_atend

But I have a lot of values on database that have 450 GB of data, and a need to make a average of the expression above.

The logical is to do a gauge chart that´s represents the average time in a selected date and show if the time is ok, our not ok. Depending on criterias.

Again, sorry for my english.

And thank you for the help.

martin59
Specialist II
Specialist II

Ok,

If I were you, I will calculate the expression in the load script, like this :

interval(min(dh_doc) - dh_atend) as dh_interval


Maybe, you should be transform your datas to attempt this formula...

After that, you have to use this field for your average :

avg(dh_interval)


Not applicable
Author

The problem is how to count the first register of table, only the first register must be calculated.

martin59
Specialist II
Specialist II

Sorry, but I don't understand what you want...