I'm trying to build a database which keeps track of investment funds over time. At the end of each month the follwing info is captured: FundName, Date, Return - these are the most important. I have follwing tables: FundName(Name,id), Date(Date,id), FundData(lookup FundName,lookup Date, return).
Relationships-- FundName:FundData - One to many
Date:FundData - One to many
My next step is building a query where it creates an index for each fund. The logic behind this is that when you need the return over 60 months you just need the value of the index now and 60 months ago. You can then annualise.
When a fund starts the index starts at a 100. Each month it increases/decreases with the return ie if return is 5% then index = 100*(1+0.05) = 105. Next month return is -1.5% then index is 105*(1-0.015)=103.43.
My query has following fields which i get from a table (FundDataTbl): FundNameID, DateID, PortfolioRet. FundNameID, DateID both displays values which it looks up form FundNameTbl and DateTbl. From these fields I need to calculate the index.
My problem: How do I obtain the return corresponding to a fund for the previous month? I tried using the Dlookup method, but it keeps returning a null value.
It is: dlookup("[PortfolioRet]","FundDataTbl","[FundDataTbl]![FundNameID]=FundNameID AND [FundDataTbl]![DateID]=DateID-1").
DateID is a number so it is not necessary to use dateadd method.
Any Suggestions?
I'm including the relevant parts of the database. All data is dummy data.
Relationships-- FundName:FundData - One to many
Date:FundData - One to many
My next step is building a query where it creates an index for each fund. The logic behind this is that when you need the return over 60 months you just need the value of the index now and 60 months ago. You can then annualise.
When a fund starts the index starts at a 100. Each month it increases/decreases with the return ie if return is 5% then index = 100*(1+0.05) = 105. Next month return is -1.5% then index is 105*(1-0.015)=103.43.
My query has following fields which i get from a table (FundDataTbl): FundNameID, DateID, PortfolioRet. FundNameID, DateID both displays values which it looks up form FundNameTbl and DateTbl. From these fields I need to calculate the index.
My problem: How do I obtain the return corresponding to a fund for the previous month? I tried using the Dlookup method, but it keeps returning a null value.
It is: dlookup("[PortfolioRet]","FundDataTbl","[FundDataTbl]![FundNameID]=FundNameID AND [FundDataTbl]![DateID]=DateID-1").
DateID is a number so it is not necessary to use dateadd method.
Any Suggestions?
I'm including the relevant parts of the database. All data is dummy data.