dbTalk Databases Forums  

Calculated Time Member for Current Date

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


Discuss Calculated Time Member for Current Date in the microsoft.public.sqlserver.olap forum.



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

Default Calculated Time Member for Current Date - 08-17-2006 , 08:39 PM






I want to add a calculated member to the Fiscal Time hierarchy of my
Time dimension which represents the current week based on the system
date. So something like this:

[Time].[Fiscal Time].[Current Week]
which would equal
[Time].[Fiscal Time].[Fiscal Week].[08/13/2006] (i.e. week ending
8/13/2006)

I added the following code to my cube's calculations:

CREATE HIDDEN [Current Date String] =
CStr(Format(Now(), "MM/")) +
CStr(Format(Now(), "dd/")) +
CStr(DatePart("yyyy",Now()));

CREATE MEMBER CURRENTCUBE.[Time].[Fiscal Time].[Current Week]
AS
StrToMember("[Date].[Fiscal Time].[Actual Date].[" + [Current Date
String] + "].Parent");

However, when I browse the cube and filter by this member, any measures
on the browser do not change. Am I on the right track?


Reply With Quote
  #2  
Old   
Deepak Puri
 
Posts: n/a

Default Re: Calculated Time Member for Current Date - 08-18-2006 , 08:22 PM






A couple of checks may help identify the issue:


1) If you hard-code a date, does that work, like:

CREATE MEMBER CURRENTCUBE.[Time].[Fiscal Time].[Current Week] AS
StrToMember("[Date].[Fiscal Time].[Actual Date].["
+ "08/18/2006" + "].Parent");

2) Create a measure to display the string built, like:

CREATE MEMBER CURRENTCUBE.[Measures].[WeekString] AS
"[Date].[Fiscal Time].[Actual Date].["
+ [Current Date String] + "].Parent";


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***

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.