title: Power BI - DAX measure to calculate sales first 31 days - 'DATEADD' expects a contiguous selection
body: <p>Two tables. Sales_Fact &amp; DateKey. Joined on date.</p>
  
  <p>DateKey table dynamic based on Sales:</p>
  
  <pre><code>DateKey = CALENDAR(MIN(Sales_Fact[Date]),MAX(Sales_Fact[Date]))    
  </code></pre>
  
  <p>Sales Table has the following structure.</p>
  
  <pre><code>Customer PurchaseDate  FirstTimePurchaseDate  Amount
  A        2018/04/11       2018/02/26           500
  b        2018/04/11       2018/03/01           300
  c        2018/04/11       2018/04/11           400
  A        2018/04/12       2018/02/26           100
  b        2018/04/12       2018/03/01           200
  c        2018/04/12       2018/04/11           400
  </code></pre>
  
  <p><strong>I want to calculate total purchase amount per customer 31 days after they made their first purchase.</strong> The Sales table has continuous dates for the last 2 year, no 'purchase date' missing.</p>
  
  <p>Following measure returns the 'DATEADD' expects a contiguous selection... error</p>
  
  <pre><code>First 31 days  = CALCULATE(SUM(Sales_Fact[Amount]),DATESBETWEEN(Sales_Fact[PurchaseDate],MIN(Sales_Fact[FirstTimePurchaseDate]),DATEADD(Sales_Fact[PurchaseDate],31,DAY)))
  </code></pre>
  
  <p>How should the DAX expression be written in order for this measure to work?</p>
  
  <p>Thanks</p>