Hamish4444
New Member
- Joined
- Mar 3, 2015
- Messages
- 12
I want to create a query that calculates daily investment returns. The formula would be Market Value today divided by Market Value yesterday. Where I'm struggling is how to tell access to grab the market value from yesterday. My current TotalMarketValue query looks like this:
[TABLE="width: 500"]
<tbody>[TR]
[TD]TotalMV[/TD]
[TD]Date[/TD]
[/TR]
[TR]
[TD]100[/TD]
[TD]11/01/2016[/TD]
[/TR]
[TR]
[TD]110[/TD]
[TD]11/02/2016[/TD]
[/TR]
[TR]
[TD]132[/TD]
[TD]11/03/2016[/TD]
[/TR]
</tbody>[/TABLE]
I want to create a new query that divides the 132 by 110 to produce 20% daily return for 11/03/2016; and then 110 / 100 = 10% for 11/02/2016.
The output would look as follows.
[TABLE="width: 500"]
<tbody>[TR]
[TD]DailyReturn[/TD]
[TD]Date[/TD]
[/TR]
[TR]
[TD]10%[/TD]
[TD]11/02/2016[/TD]
[/TR]
[TR]
[TD]20%[/TD]
[TD]11/03/2016[/TD]
[/TR]
</tbody>[/TABLE]
I'm just not sure how to tell Access to use the market value from a day in the past as the denominator.
Any help would be greatly appreciated!
Thanks.
[TABLE="width: 500"]
<tbody>[TR]
[TD]TotalMV[/TD]
[TD]Date[/TD]
[/TR]
[TR]
[TD]100[/TD]
[TD]11/01/2016[/TD]
[/TR]
[TR]
[TD]110[/TD]
[TD]11/02/2016[/TD]
[/TR]
[TR]
[TD]132[/TD]
[TD]11/03/2016[/TD]
[/TR]
</tbody>[/TABLE]
I want to create a new query that divides the 132 by 110 to produce 20% daily return for 11/03/2016; and then 110 / 100 = 10% for 11/02/2016.
The output would look as follows.
[TABLE="width: 500"]
<tbody>[TR]
[TD]DailyReturn[/TD]
[TD]Date[/TD]
[/TR]
[TR]
[TD]10%[/TD]
[TD]11/02/2016[/TD]
[/TR]
[TR]
[TD]20%[/TD]
[TD]11/03/2016[/TD]
[/TR]
</tbody>[/TABLE]
I'm just not sure how to tell Access to use the market value from a day in the past as the denominator.
Any help would be greatly appreciated!
Thanks.