Clorox
09-07-2006, 02:58 PM
Hello all,
I've got a table/query that has the returns for several hedge funds and is structured as follows:
ID Date Return
(there are more fields in the table, but these are the only relevant ones that appear in the query). The inception dates vary for each of the funds, but the ending date is always the same. Each date represents a month-end date.
Therefore, in this case, ID and Date are primary keys, and there can be duplicate IDs, but every ID/Date combination is unique (For example, there can only be one return for 1/31/2006 for the fund with ID #35.
What I would like to do is create a query or some code that takes the dates and returns for each fund and determines the annualized return since inception of that fund up until a specified date. Therefore, if fund ID #1 has 14 months of returns ending on 6/30/2006, I'd like to take ((1+% return in month 1)*(1+%return in month 2)*(1+% return in month 3 and so on))^(12/(# of months, in this case 14))-1 which would give me the annualized return over the 14 months (of course, for fund #2 or #3 it might be 20 months or even 50 months). I know that in Excel, if I have the array chosen I can do an array formula of {=PRODUCT(A1:A51+1)-1} to get the cumulative return. However, I'd like to avoid putting anything in Excel if possible because ideally I'd like to be able to run a report that will output MTD, QTD, YTD and since inception returns for a number of different funds. MTD, QTD and YTD I've obviously already figured out since those are easy, but this is a tricky one.
Then, I'd like the query to output the following:
ID AnnualizedReturn
Hope that makes sense.
Thanks for any and all help/suggestions!!!
Also, FYI - I don't know SQL very well, but I can write some VBA and I am decent at reading SQL to understand what it's doing.
I've got a table/query that has the returns for several hedge funds and is structured as follows:
ID Date Return
(there are more fields in the table, but these are the only relevant ones that appear in the query). The inception dates vary for each of the funds, but the ending date is always the same. Each date represents a month-end date.
Therefore, in this case, ID and Date are primary keys, and there can be duplicate IDs, but every ID/Date combination is unique (For example, there can only be one return for 1/31/2006 for the fund with ID #35.
What I would like to do is create a query or some code that takes the dates and returns for each fund and determines the annualized return since inception of that fund up until a specified date. Therefore, if fund ID #1 has 14 months of returns ending on 6/30/2006, I'd like to take ((1+% return in month 1)*(1+%return in month 2)*(1+% return in month 3 and so on))^(12/(# of months, in this case 14))-1 which would give me the annualized return over the 14 months (of course, for fund #2 or #3 it might be 20 months or even 50 months). I know that in Excel, if I have the array chosen I can do an array formula of {=PRODUCT(A1:A51+1)-1} to get the cumulative return. However, I'd like to avoid putting anything in Excel if possible because ideally I'd like to be able to run a report that will output MTD, QTD, YTD and since inception returns for a number of different funds. MTD, QTD and YTD I've obviously already figured out since those are easy, but this is a tricky one.
Then, I'd like the query to output the following:
ID AnnualizedReturn
Hope that makes sense.
Thanks for any and all help/suggestions!!!
Also, FYI - I don't know SQL very well, but I can write some VBA and I am decent at reading SQL to understand what it's doing.