Re: Need some tips on query generating averages on time series data

From: Lennart Jonsson <>
Date: Thu, 24 Oct 2013 20:26:49 +0200
Message-ID: <l4bopa$50k$>

On 10/24/2013 05:03 PM, wrote:
> Lennart:
> What OLAP functions? I don't see any in your reply or in the thread.

sum(qnt) over (partition by ...)

perhaps it is named otherwise here, but that's what I meant. I assume these kind of functions will be the key to solving your problem.

> How did I get 109.7
> - by subtracting the buy and sell time for 200 shares (rows 4 and 8 as these
> match up by quantity and direction (one is buy and the other is sell).
> So, the calc here is 12678 - 12568.3.
> How did I get 21940?
> - by multiplying 109.7 by 200. This is the weighted hold time. At the end I
> divide by the total number of shares traded (500) to come up with weighted
> average hold time.

Ok, I think I understand the problem now. I'll see what I can come up with

/Lennart Received on Thu Oct 24 2013 - 20:26:49 CEST

Original text of this message