Hi,
I have a stock price related dataset that is generated every second (including stock_name, timestamp, last_price matched, total_volume traded). The total volume traded is a running total from a point in time. The dataset has multiple different stocks.
I am trying to calculate the volume traded in each second for each stock. i.e. calculate the difference between sequential total_volume_traded figures for each stock. I “think” I need to do this as a calculated column as I need the result in a further calculation. Ultimately I am looking to calculate a weighted price over time.
I have tried to create a filtered set for just the 2 sequential rows. This doesn’t produce an error it just displays no value:
=CALCULATE(
SUMX(FILTER(Stocks,Stocks[Seconds_from_midnight+1]=Stocks[Seconds from midnight]+1),Stocks[Stock_total_matched]),
ALLEXCEPT(
Stocks,
Stocks[stock_name],
Stocks[Seconds_from_midnight+1]
)
)
Any suggestions as to how I might tackle this would be much appreciated and gratefully received.
Thanks
I have a stock price related dataset that is generated every second (including stock_name, timestamp, last_price matched, total_volume traded). The total volume traded is a running total from a point in time. The dataset has multiple different stocks.
I am trying to calculate the volume traded in each second for each stock. i.e. calculate the difference between sequential total_volume_traded figures for each stock. I “think” I need to do this as a calculated column as I need the result in a further calculation. Ultimately I am looking to calculate a weighted price over time.
I have tried to create a filtered set for just the 2 sequential rows. This doesn’t produce an error it just displays no value:
=CALCULATE(
SUMX(FILTER(Stocks,Stocks[Seconds_from_midnight+1]=Stocks[Seconds from midnight]+1),Stocks[Stock_total_matched]),
ALLEXCEPT(
Stocks,
Stocks[stock_name],
Stocks[Seconds_from_midnight+1]
)
)
Any suggestions as to how I might tackle this would be much appreciated and gratefully received.
Thanks