Cumulative distinct count
740298Dec 10 2009 — edited Dec 10 2009Hello,
I have a question about analytic functions. What I'm trying to achive is: Calculate the cumulative distinct count.
For example at 20091001 I need to count the distinct subscribers on that date. At 20091002 I need to consider 20091001 also. 20091003 I need to consider 20091001 and 20091002. You got the point.
Below I've attached the input data and also my desired result. I tried some of the windowing functions with no luck.
Using 10gR2 Enterprise edition
Thanks,
Onur
DATA:
daily_calendar_id subsriber_id
20091001 1
20091001 3
20091001 4
20091001 3
20091001 4
20091001 5
20091001 6
20091001 2
20091001 4
20091001 1
20091001 1
20091001 3
20091002 7
20091002 8
20091002 3
20091002 2
20091002 1
20091002 5
20091002 12
20091003 10
20091003 12
20091003 4
20091003 6
20091003 4
20091003 3
20091003 4
20091003 17
20091003 16
20091004 17
20091004 18
20091004 19
20091004 20
20091004 1
20091004 2
20091004 21
DESIRED RESULT:
daily_calendar_id Cumulative_distinct_subscriber_count
20091001 6
20091002 9
20091003 12
20091004 16
Edited by: user6299691 on 10-Dec-2009 05:04