dbTalk Databases Forums  

PeriodsToDate function

microsoft.public.sqlserver.olap microsoft.public.sqlserver.olap


Discuss PeriodsToDate function in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
grossk
 
Posts: n/a

Default PeriodsToDate function - 11-18-2005 , 04:32 PM






I'm using the PeriodsToDate function to sum up a measure over time to
give me a running total for a given time member:

Sum(PeriodsToDate([Time].[(All)]), [Measures].[Ending Active Enrollment
Change])

For the most part it works great. However, I'll soon be expanding my
Time dimension to include 2006 and the powers that be don't want this
metric to be displyed for time members beyond the current month.

Any thoughts on how I could accomplish this?


Reply With Quote
  #2  
Old   
Darren Gosbell
 
Posts: n/a

Default Re: PeriodsToDate function - 11-18-2005 , 10:17 PM






There are 2 issues here, defining the current month and figuring out
where the current time member is in relation to it.

There are 2 common ways of figuring out the current month. One is to use
date/time functions to calculate the member name based of the actual
date. The other is to use the last non-empty month. You should be able
to find examples of both of these by searching this group in google.

One possible way to figure out if a given member is before the current
month would be to add a member property to the month either as an
incremental number or something in the form YYYYMM, then use the
following:

Quote:
IIF(CInt(Time.CurrentMember.Properties("MonthSeque nce")) <= CInt(Time.
[Current Month>]
,
<insert periods to date function here>
,
null
)
Quote:


You could also use a set based approach, but this would not be as
efficient:

Quote:
IIF(COUNT(INTERSECT(Time.CurrentMember,Time.Month. members.item(0):time.
[<Current Month>])) = 1
,
<insert periods to date function here>
,
null
)
Quote:

--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell

In article <1132353128.475425.240700 (AT) g49g2000cwa (DOT) googlegroups.com>,
grossk6309-signup1 (AT) yahoo (DOT) com says...
Quote:
I'm using the PeriodsToDate function to sum up a measure over time to
give me a running total for a given time member:

Sum(PeriodsToDate([Time].[(All)]), [Measures].[Ending Active Enrollment
Change])

For the most part it works great. However, I'll soon be expanding my
Time dimension to include 2006 and the powers that be don't want this
metric to be displyed for time members beyond the current month.

Any thoughts on how I could accomplish this?



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.