title: DAX Cumulative Total With Date Filters
body: <p>I am trying to calculate a running total where orders are only valid during a certain date range.  Each order has a value, a start date and an end date.  I want to calculate the cumulative sum of the order's values only during the dates between an order's start date and end date.  </p>
  
  <p>I've read over <a href="http://www.daxpatterns.com/cumulative-total/" rel="nofollow noreferrer">this article</a> on cumulative totals and have an equation for the running total but I can't figure out how to filter the equation so that it filter's out an order once the date table is past the order's End Date.  The current measure I have is <code>Cumulative Value:=CALCULATE(SUM(Orders[Vaue]), FILTER(ALL('Date'), [Date] &lt;= MAX([Date])))</code> and I want to add a filter that filters out any orders with an end date past the current date row, similar to this <code>Filter('Order', 'Orders'[Order_End_Date] &lt; 'Date'[Date])</code>.  When I try to add this filter though I get an error since 'Date'[Date] is not used in any aggregation.</p>
  
  <p>Below is the data model that I am using and <a href="https://drive.google.com/file/d/0B0yOs8NYx0OtQ2UzbEhNTDNDTmM/view" rel="nofollow noreferrer">a link to the Excel File</a> with the data model.</p>
  
  <p><a href="https://i.stack.imgur.com/PXrrW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PXrrW.png" alt="Example Data Model"></a></p>
  
  <p>The sample Data:<br>
  <code>+-----------+
  |   Date    |
  +-----------+
  | 1/1/2015  |
  | 1/2/2015  |
  | 1/3/2015  |
  | 1/4/2015  |
  | 1/5/2015  |
  | 1/6/2015  |
  | 1/7/2015  |
  | 1/8/2015  |
  | 1/9/2015  |
  | 1/10/2015 |
  +-----------+</code> </p>
  
  <p><code>+----------+------+------------------+----------------+
  | Order_Id | Vaue | Order_Start_Date | Order_End_Date |
  +----------+------+------------------+----------------+
  |        1 |    1 | 1/1/2015         | 1/3/2015       |
  |        2 |    3 | 1/2/2015         |                |
  |        3 |    6 | 1/3/2015         | 1/7/2015       |
  |        4 |    7 | 1/5/2015         |                |
  +----------+------+------------------+----------------+</code></p>
  
  <p>And the output of the current measure I have and what the correct measure's output should be.<br>
  <code>+-----------+-----------------+--------------------------+
  |   Date    | Current Measure | Desired Measure's Output |
  +-----------+-----------------+--------------------------+
  | 1/1/2015  |               1 |                        1 |
  | 1/2/2015  |               4 |                        4 |
  | 1/3/2015  |              10 |                        9 |
  | 1/4/2015  |              10 |                        9 |
  | 1/5/2015  |              17 |                       16 |
  | 1/6/2015  |              17 |                       16 |
  | 1/7/2015  |              17 |                       10 |
  | 1/8/2015  |              17 |                       10 |
  | 1/9/2015  |              17 |                       10 |
  | 1/10/2015 |              17 |                       10 |
  +-----------+-----------------+--------------------------+</code></p>