Running Total

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having a problem with a running total. I have the following statement in
a query named [Matrix Pattern].

SELECT [Matrix Data].Day AS [Day], [Leads]/(SELECT SUM(Leads) FROM [Matrix
Data]) AS Percentage, (SELECT SUM(Percentage) FROM [Matrix Pattern] AS X
WHERE X.Day <= [Day]) AS PTotal
FROM [Matrix Data];

This statement gives me 100% for every record when I need it to return the
following

Day Percentage PTotal
1 .1 0.1
2 .5 0.6
3 .4 1.0

What am I doing wrong?
 
Booner,

Your query [Matrix Pattern] refers to itself, which doesn't seem to me
like it could work. If you take out the PTotal field, is the Percentage
calculated correctly? You may need to restructure things to get PTotal.

Jerry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top