title: Access Cumulative Total by Date
body: <p>I need to show the cumulative power of all our energy projects by their online date. </p>
  
  <p>So, if a project came online in 2016, it was also online in 2017 and 2018 and should be counted in those totals. I basically need a table that answers the questions </p>
  
  <pre><code>      "What was our energy capacity as of 12/31/2016, 12/31/2017,etc"
  </code></pre>
  
  <p>I can do it by running a simple query over and over with different dates, but ideally I would run just one query and get the table I need. </p>
  
  <p>I don't actually know how to code in SQL, so I just use the Access query designer, which might be making things more difficult.</p>
  
  <p>Simple Query that gets what I want:</p>
  
  <pre><code>SELECT Sum(Projects.[System Size AC]) AS [SumOfSystem Size AC]
  FROM Projects
  WHERE (((Projects.[Online Date])&lt;#1/1/2018#));
  </code></pre>
  
  <p>Query that gets an error:</p>
  
  <pre><code>SELECT DSum([Projects]![System Size AC],[Projects],Year([Online Date])&lt;=[Yr]) AS [Run Sum], Year([Online Date]) AS Yr
  FROM Projects
  GROUP BY Year([Online Date]);
  </code></pre>
  
  <p>I can do it by running the simple query over and over with different dates, but ideally I would get one table with all the years in the online date column with like a cumulative total of all available project capacity available during that year</p>