All Forums Database
DataFreak 1 post Joined 08/15
10 Aug 2015
YTD calculation for distinct buyers

Hi Everyone
Pls help me in solving teradata sql query. I want to know the total YTD active buyers on my website. which includes the buyers for first time (FT)also  the returning buyers(RB). 

i.e. January should have FT (Jan) + RB (Jan)

Feb = FT (Jan) + FT (Feb) + RB (Jan+Feb combined)

Mar = FT (Jan) + FT (Feb) + FT (Mar) + RB (Jan + Feb + Mar combo)

i.e. for YTD logic,


FT & RB numbers should be select distinct(buyer_id) between year_beg_date and month_end_Dt


i need it for a time period from 2012 jan till date. 

You must sign in to leave a comment.