L
Laura C.
I have created a crosstab query that displays values for individuals across
time as follows:
Name TransactionDate1 TransactionDate2
Shareholder1 50 -10
Shareholder2 30 -10
Shareholder3 10 -5
I'm hoping that there is some way I can add a Row Heading that calculates
totals for each Shareholder following each TransactionDate, like so:
Name TD1 TotalAfterTD1 TD2
TotalAfterTD2
Shareholder1 50 50 -10
40
Shareholder2 30 30 -10
20
Shareholder3 10 10 -5
5
The transactions do not occur at regular intervals, which is why I have not
been able to adapt any of the solutions I've found on this site for tallying
totals, say, by month.
I also tried using the query as the basis for a report so that I could
create a Running Sum text box for this purpose, but was told that I had too
many fields for the report. Again, I can't see how I would standardize the
dates to yield fewer fields since the transactions don't occur at regular
intervals.
I've gotten the sense that I need to use the Dsum function. The following
suggestion from John Vinson (adapted with my field names) seemed to be on the
right track:
=DSum([Date], [PerDay2009-Dec31Totals_Q], [Date] <= #" & [Date] & "#)
But I can't figure out how to insert the above into my existing query.
Here is the SQL for my crosstab query:
TRANSFORM Sum([PerDay2009-Dec31Totals_Q].Shares) AS SumOfShares
SELECT [PerDay2009-Dec31Totals_Q].[Full Name],
Sum([PerDay2009-Dec31Totals_Q].Shares) AS [Total Of Shares]
FROM [PerDay2009-Dec31Totals_Q]
GROUP BY [PerDay2009-Dec31Totals_Q].[Full Name]
ORDER BY [PerDay2009-Dec31Totals_Q].Date
PIVOT [PerDay2009-Dec31Totals_Q].Date;
Any help you can offer would be most appreciated.
time as follows:
Name TransactionDate1 TransactionDate2
Shareholder1 50 -10
Shareholder2 30 -10
Shareholder3 10 -5
I'm hoping that there is some way I can add a Row Heading that calculates
totals for each Shareholder following each TransactionDate, like so:
Name TD1 TotalAfterTD1 TD2
TotalAfterTD2
Shareholder1 50 50 -10
40
Shareholder2 30 30 -10
20
Shareholder3 10 10 -5
5
The transactions do not occur at regular intervals, which is why I have not
been able to adapt any of the solutions I've found on this site for tallying
totals, say, by month.
I also tried using the query as the basis for a report so that I could
create a Running Sum text box for this purpose, but was told that I had too
many fields for the report. Again, I can't see how I would standardize the
dates to yield fewer fields since the transactions don't occur at regular
intervals.
I've gotten the sense that I need to use the Dsum function. The following
suggestion from John Vinson (adapted with my field names) seemed to be on the
right track:
=DSum([Date], [PerDay2009-Dec31Totals_Q], [Date] <= #" & [Date] & "#)
But I can't figure out how to insert the above into my existing query.
Here is the SQL for my crosstab query:
TRANSFORM Sum([PerDay2009-Dec31Totals_Q].Shares) AS SumOfShares
SELECT [PerDay2009-Dec31Totals_Q].[Full Name],
Sum([PerDay2009-Dec31Totals_Q].Shares) AS [Total Of Shares]
FROM [PerDay2009-Dec31Totals_Q]
GROUP BY [PerDay2009-Dec31Totals_Q].[Full Name]
ORDER BY [PerDay2009-Dec31Totals_Q].Date
PIVOT [PerDay2009-Dec31Totals_Q].Date;
Any help you can offer would be most appreciated.