Quantcast
Channel: Teradata Forums - All forums
Viewing all articles
Browse latest Browse all 27759

calculate recency & absolute deviation for a dataset - response (1) by dnoeth

$
0
0

Nest the aggregate in an OLAP function:

SELECT
   customerid,
   MAX(purchasedate) - MIN(purchasedate),
   MAX(MAX(purchasedate)) OVER () - MAX(purchasedate) 
FROM tab
GROUP BY 1

Dieter
 


Viewing all articles
Browse latest Browse all 27759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>