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: 
realpixel
Creator
Creator

average count

Hello,

I use the following expression to have the average of the column Ecart Datr/Datfac (DELTA1)

avg(num (Interval(DTFAC1-DFAC1)))

The result give me 14,27 if I extract in Excel the total of expression give me 2712 and the number the line is 187 (without the blank field)

2712/187 = 14,5026 is not the same 14,27

Someone have an idea, maybe because the column Ecart Datr/Datfac (DELTA1) have a field blank?

4 Replies
swuehl
MVP
MVP

Yes, I assume the difference is because of NULLs in your field.

Have you tried summing up your field and dividing by the count of an appropriate field (not containing NULLs)?

Like

=sum( DELTA1) / count( KEYFIELD)

realpixel
Creator
Creator
Author

Thank you Swuehl for your reply

Yes I want to try to sum my [Ecart Datr/Datfac (DELTA1)] and divide by the count of an appropriate field (not containing NULL value)

I tried someting lik that =sum( [Ecart Datr/Datfac (DELTA1)]) / count( KEYFIELD) but I don't know what kind of value in KEYFIELD?

swuehl
MVP
MVP

That's hard to answer without knowing your data.

I assume your field you want to average is located in a table, and it's not the only field in the table.

Probably one of the other fields does not have NULLs, maybe your key field or some other appropriate field.

You'll need to describe your setting a bit closer if you want someone to help you identifying the appropriate field.

realpixel
Creator
Creator
Author

This a part of my table

I need to have the average for the expression under

Ecart Datr/Datfac (DELTA1) = avg(num (Interval(DTFAC1-DFAC1)))

Ecart Dabord./Datr (DELTA2) = num(Interval(DBOR1-DTFAC1))

Ecart Da. Arcli/Dabord (DELTA3) = avg(num(Interval(DACR1-DBOR1)))

TYPE FACTUREMETIERS              DFAC1               DTFAC1              DBOR1             DACR1Ecart Datr/Datfac (DELTA1) Ecart Dabord./Datr (DELTA2)  Ecart Da. Arcli/Dabord (DELTA3)
FactureTRANSIT13/09/201316/09/201316/09/201316/09/2013300
FactureTRANSIT13/09/201316/09/201316/09/201316/09/2013300
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureTRANSIT13/09/201316/09/201316/09/201317/09/2013301
FactureLOGISTIQUE23/09/201330/09/201330/09/201330/09/2013700
AvoirTRANSIT11/02/2013-20/02/201320/03/2013--28
FactureTRANSIT30/01/2013-15/03/201320/03/2013--5
AvoirTRANSIT10/05/2013-13/05/201314/05/2013--1
FactureTRANSIT06/02/2013-11/02/201312/02/2013--1
FactureTRANSIT06/02/2013-11/02/201312/02/2013--1
FactureTRANSIT07/02/2013-11/02/201312/02/2013--1
FactureTRANSIT28/01/2013-12/02/201313/02/2013--1
FactureTRANSIT29/03/2013-02/04/201303/04/2013--1
FactureTRANSIT29/03/2013-02/04/201303/04/2013--1
FactureTRANSIT30/03/2013-02/04/201303/04/2013--1
FactureTRANSIT26/04/2013-30/04/201302/05/2013--2
FactureTRANSIT29/04/2013-30/04/201302/05/2013--2
FactureTRANSIT29/04/2013-30/04/201302/05/2013--2
FactureTRANSIT29/04/2013-30/04/201302/05/2013--2
FactureTRANSIT29/04/2013-30/04/201302/05/2013--2
FactureTRANSIT29/04/2013-30/04/201302/05/2013--2
FactureTRANSIT27/06/2013-27/06/201328/06/2013--1
FactureTRANSIT27/06/2013-27/06/201328/06/2013--1
FactureTRANSIT30/08/2013-02/09/201303/09/2013--1
FactureTRANSIT30/08/2013-02/09/201303/09/2013--1
FactureTRANSIT29/01/2013-13/02/201318/02/2013--5
FactureTRANSIT08/02/2013-13/02/201318/02/2013--5
AvoirTRANSIT11/02/2013-13/02/201318/02/2013--5
FactureTRANSIT07/01/2013-16/01/201305/03/2013--48