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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
thomaswrieck
Partner - Creator
Partner - Creator

avarage calculation

Hello,

I need to calculate the avarage of days based on a fix startdate and multiple enddates.

E.G.

Start Date = 03/23/2009

EndDate 1 = 04/02/2009 days1 = StartDate-EndDate1

EndDate 2 = 05/07/2009 days2 = StartDate-EndDate2

EndDate3 = 06/14/2009 days3 = StartDate-EndDate3

So, the avarage is days1+days2+days3/3

I'm looking for a way to do this calculation in one formular if possible. Something like avg(EndDate-StartDate) ...

Thanks for any hint or solution

Thomas

3 Replies
renjithpl
Specialist
Specialist

i am not sure,

is it something like this

in your load script you can give some thing like below

makedate(2009, 03, 23) as StartDate,

EndDate,

-(makedate(2009, 03, 23) - EndDate) as Days

Then you can try

=Avg(Days) gives average of days.

Thanks

thomaswrieck
Partner - Creator
Partner - Creator
Author

that will work for sure ... any clue doing this without pre-calculate days in the script ?

googel84
Partner - Creator III
Partner - Creator III

Try using rangeavg funcition. You can find more at page 378 (1265) of QlikView Reference Manual.