title: Spotfire data difference: same column
body: <p>I have the following table:</p>
  
  <pre><code>Id  Claim_id    Date        
  4   111         10/08/2017  
  5   333         27/08/2017  
  2   111         07/08/2017  
  3   222         08/08/2017  
  1   444         03/07/2017  
  7   333         02/09/2017  
  6   333         28/08/2017  
  </code></pre>
  
  <p>there are more rows (dates) associated to the same Claim_id; column "Id" is based on column "Date" (more recent dates have a greater Id).</p>
  
  <p>I need to create a Calculated Column given by the date difference over claim_id, with the following output:</p>
  
  <pre><code>Id  Claim_id    Date        Days
  3   111         10/08/2017  3
  1   333         27/08/2017  
  2   111         07/08/2017  
  4   222         08/08/2017  
  7   444         03/07/2017  
  6   333         02/09/2017  5
  5   333         28/08/2017  1
  </code></pre>
  
  <p>I have tried to use the code given here: <a href="https://stackoverflow.com/questions/31344663/spotfire-date-difference-using-over-function">Spotfire date difference using over function</a> but it doesn't work (it produces wrong values).
  I think that, maybe, it's because my table is not sorted, but I can't order it because I have no access to the source database.</p>
  
  <p>How can I modify that expression? 
  Thank you!</p>
  
  <p>Valentina</p>