title: SQL LAG IN CASE STATEMENT
body: <p>I would appreciate any pointers on what is wrong with my case statement, if the Current CLUSTERn = Previous CLUSTERn Then add the Previous PRODCAT to the current line as PREVCAT...</p>
  
  <pre><code>ORA-30484: missing window specification for this function
  30484. 00000 -  "missing window specification for this function"
  *Cause:    All window functions should be followed by window specification,
             like &lt;function&gt;(&lt;argument list&gt;) OVER (&lt;window specification&gt;)
  *Action:
  Error at Line: 11 Column: 30
  </code></pre>
  
  <pre><code>SELECT  CLUSTERn,
          MEMBERn,
          COUNT(*) OVER ( PARTITION BY CLUSTERn ORDER BY MEMBERn, PRODCAT, STARTd, ENDd ) AS NEWRANK,
          CASE WHEN CLUSTERn = LAG(CLUSTERn) THEN LAG(PRODCAT) ELSE 'New' END AS PREVCAT,
          STATUS,
          PRODCAT,
          JOINTYPE,
          JOINRANK,
          CSP,
          PROGID,
          PROMNAME,
          PROMOID,
          COHORT,
          FWEEK,  
          STARTd,
          ENDd,
          SOURCE
  FROM(
  </code></pre>