M
Mishanya
I'm new to Access, so maybe my "solutions" are barbarian, but this is what
I've got.
I've found that Access has no straightforward way of dealing with relative
calculations between different records (values) of the same field. In my case
I needed to query PortfolioValue of Period(n) and compare it to
PortfolioValue of Period(n-1). In my report I needed to put in one line both
PortfolioValue(n) and PortfolioValue(n-1) for several consecutive periods and
also make some calculations on it (like Yield, wich is subtruction of the
former from the latter , etc.).
I could do so helped by the great revelation of the subquery method provided
by Allen Browne in his website. I've created PreviousPortfolioValue variable
using SQL phrase SELECT TOP 1 Demi.PortfolioValue FROM tblPortfolioFlow AS
Demi WHERE Demi.Date < tblPortfolioFlow.Date as an expression. So far so good.
Now I need to calculate the sum of all the periods' yields and divide it by
the PortfolioValue(0) in order to obtain the Quaterly (Yearly) Rate Of
Return. Here problems started.
When trying to put =Sum(Yield) in the report footer, I get error msg
"Multilevel expression GROUP BY is not allowed in subquery", although I have
no totals or groupings in the main query nor in the subquery (and they work
fine). When planting the report into another report and putting
=Sum([MyReport].[Report]![Yield]) I get #error in the textbox.
I'll be grateful if someone can advise on the issue.
I've got.
I've found that Access has no straightforward way of dealing with relative
calculations between different records (values) of the same field. In my case
I needed to query PortfolioValue of Period(n) and compare it to
PortfolioValue of Period(n-1). In my report I needed to put in one line both
PortfolioValue(n) and PortfolioValue(n-1) for several consecutive periods and
also make some calculations on it (like Yield, wich is subtruction of the
former from the latter , etc.).
I could do so helped by the great revelation of the subquery method provided
by Allen Browne in his website. I've created PreviousPortfolioValue variable
using SQL phrase SELECT TOP 1 Demi.PortfolioValue FROM tblPortfolioFlow AS
Demi WHERE Demi.Date < tblPortfolioFlow.Date as an expression. So far so good.
Now I need to calculate the sum of all the periods' yields and divide it by
the PortfolioValue(0) in order to obtain the Quaterly (Yearly) Rate Of
Return. Here problems started.
When trying to put =Sum(Yield) in the report footer, I get error msg
"Multilevel expression GROUP BY is not allowed in subquery", although I have
no totals or groupings in the main query nor in the subquery (and they work
fine). When planting the report into another report and putting
=Sum([MyReport].[Report]![Yield]) I get #error in the textbox.
I'll be grateful if someone can advise on the issue.