Calculating number of subscriptions in time


hi all,

i'm new sql , mdx in general i'm trying build following , maybe guys can me.

i have snowflake database table containing subscription. each subscription has date/time @ starts , date/time @ terminated:

subscription:

id start_date end_date ....
100 10-jul-2005 17:00 10-aug-2005 11:00 ...
101 11-jun-2005 17:00 12-dec-2006 18:00 ...
102 1-may-2005 17:00 17-jan-2007 13:00 ...
103 10-apr-2005 17:00 10-sep-2005 15:00 ...

and there dimension-table called datetime:
id year month ....
10-jul-2005 17:00 2005 06 ...
10-jul-2005 18:00 2005 06 ...
... .. .. ...
11-jul-2005 17:00 2005 06 ...
11-jul-2005 18:00 2005 06 ...


as generate count-measures start-date , end-date (e.g. number of subscriptions started @ given moment: 1 started @ 10-jul-2005 17:00). want know how many subscription active @ given moment (e.g. 0 @ 1-jan-2005 12:00, 2 @ 1-jan-2006 12:00 , 4 @ 1-aug-2005 12:00). in sql i produce 'select count(*) subscription measuredate between start_date , end_date' but how create in as using mdx?

tia,
ferdinand

well, in report there 1 date number of subscriptions, there isn't start_date , end_date. assume means number of active subscriptions @ date. standard way of doing maintaining in fact table measure "number of subscriptions", , put 1 when there activation , -1 when there termination. implementing running sum calculation on lowest level of date dimension - need. this problem same as classic inventory management problem - can read more here: http://www.sqlserveranalysisservices.com/olappapers/inventorymanagement%20in%20as2005v2.htm

 



SQL Server  >  SQL Server Analysis Services



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........