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

calculate recency & absolute deviation for a dataset - forum topic by suyog

$
0
0

Hi,
please check the following dataset
customerid  purchasedate 
1                      5/9/2013
1                      5/20/2013   
1                       5/29/2013
2                       6/8/2013
 
I need to calculate resultset like
"customerid" "recency (max date - min date i.e. #days)"   "deviation from last purchase date in dataset"
1                     20 (5/29/2013 - 5/9/2013)                              30 (6/8/2013 - 5/9/2013)
 
I can't use max (date) here as it will always give me for the grouping column & not teh abslute max date. is there a way to achieve this ?

Forums: 

Viewing all articles
Browse latest Browse all 27759

Trending Articles



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