title: Spotfire DateDiff Using Custom Expression
body: <p>I am attempting to calculate the number of years between MIN date and MAX date on a filtered date column then divide the result by a COUNT of Column Y OVER Column X. </p>
  
  <p>Spotfire documentation says that Custom Expressions are the key to manipulating filtered data, but I’m not sure how to pass temporary variables to a Spotfire function like DateDiff.</p>
  
  <pre><code>Example:
  DateDiff(Min([Date]),Max([Date])) / [Column.Y] OVER [Column.X]
  
   +------+----------+------------+
   | Name |   Date   | Made Sale? |
   +------+----------+------------+
   | joe  | 1/1/2010 | 10         |
   | joe  | 2/1/2011 | 11         |
   | joe  | 3/1/2012 |            |
   | joe  | 4/1/2013 | 40         |
   | joe  | 5/1/2014 |            |
   | pam  | 1/1/2010 | 100        |
   | pam  | 2/1/2011 | 19         |
   | pam  | 3/1/2012 | 23         |
   | pam  | 4/1/2013 | 30         |
   | pam  | 5/1/2014 |            |
   | mark | 1/1/2010 |            |
   | mark | 2/1/2011 | 1          |
   | mark | 3/1/2012 |            |
   | mark | 4/1/2013 |            |
   | mark | 5/1/2014 | 49         |
   +------+----------+------------+
  EG. Filter from 2011-2014, what were Joe, Pam, and Mark's frequency of sales per year?
  </code></pre>