dbTalk Databases Forums  

Is this valid - reference the caluculated member itself in the for

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


Discuss Is this valid - reference the caluculated member itself in the for in the microsoft.public.sqlserver.olap forum.



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

Default Is this valid - reference the caluculated member itself in the for - 05-17-2006 , 04:31 PM






This seem to be working... but I am a bit nervous.

I am trying to write the formula for "test". "test" is the calculated member
here but I am referencing "test" itself in the formula:

If at month level, add all QTY to be "test"
If at year level, the year "test" is the december "test" (LastChild)

Is it legal to use a calculated member itself in the formula that way?? Am I
looking for potential "weird" problems?

IIF([Time].CurrentMember.Level IS [Date].[Month],
Sum(PeriodsToDate([Time].[(All)], [Time].CurrentMember),[Measures].[QTY]),
IIF([Time].CurrentMember.Level IS
[Time].[Year],([Time].CurrentMember.LastChild,[Measures].[test])
,NULL))

Thanks for any advice.

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

Default Re: Is this valid - reference the caluculated member itself in the for - 05-17-2006 , 08:17 PM






This is a recursive calculated member definition, which can be used, for
example, to find the last non empty value:

http://msdn.microsoft.com/library/de.../en-us/dnsql2k
/html/semiadd2.asp
Quote:
Analysis Services: Semiadditive Measures and Inventory Snapshots

Amir Netz
Microsoft Corporation

Updated May 18, 2004

Applies to:
Microsoft SQL Server 2000
Microsoft SQL Server 2000 Analysis Services

Summary: Focusing on a classic inventory problem, this article describes
the implementation techniques of semiadditive measures in online
analytical processing.
...
Measures.[Last Non Empty Value]:
CoalesceEmpty((Measures.[Value], Time.CurrentMember ) ,
(Measures.[Last Non Empty Value],Time.CurrentMember.PrevMember))
Quote:
There needs to be a recursion termination condition.


- 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.