dbTalk Databases Forums  

Infinite Recursion Error

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


Discuss Infinite Recursion Error in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rahul.Bhartia@gmail.com
 
Posts: n/a

Default Infinite Recursion Error - 09-15-2005 , 08:21 AM






Hi,

The Isssue here is that there is a calculated member in a cube,which
determines the price for a given day. The Cube has data price stored
for a daterange rather than a single date i.e Start Date to End Date.
The Start Date is joined to Time Dimension at date level.
So basically, the idea here is to write a calculated member which will
check the Price for a given date, if it is Empty then it go back to the
previous date and so on, till it finds the first not Empty price value.

Now what happens is that when the gap between start date and end date
is more than 20 days it throws a recursive error.

Below given are the details of the MDX written


IIF([Time].[Financial].CurrentMember.("Business Date Id") =
[Time].[Financial].[All
Time].FirstChild.FirstChild.FirstChild.FirstChild.First Child.Properties("Business
Date Id"),
IIF(NOT ISEMPTY([Measures].[Selling Price Major]),
[Measures].[Selling Price Major],
0),
IIF(NOT ISEMPTY([Measures].[Selling Price Major]),
[Measures].[Selling Price Major],
[Time].[Financial].PrevMember)
)


We've applied SP4 to our analysis server too. Any help in this regard
will be highly appreciated.

Rahul.


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

Default Re: Infinite Recursion Error - 09-15-2005 , 08:25 PM






What if you use the "is" comparison, like:

Quote:
IIF([Time].[Financial].CurrentMember is
[Time].[Financial].[All
Time].FirstChild.FirstChild.FirstChild.FirstChild.First Child,
CoalesceEmpty([Measures].[Selling Price Major]), 0),
IIF(NOT ISEMPTY([Measures].[Selling Price Major]),
[Measures].[Selling Price Major],
[Time].[Financial].PrevMember))
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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


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

Default Re: Infinite Recursion Error - 09-15-2005 , 10:48 PM



I think the issue might be that in your "previous period" logic you are
not specifying which measure to use. It therefore uses the current
member in the measures dimension, which is the calculated measure itself
and results in "infinite" recursion.

What I think you need to do is to replace:

[Time].[Financial].PrevMember

with:

([Time].[Financial].PrevMember,[Measures].[Selling Price Major])

which will tell the formula to return the [Selling Price Major] measure
from the previous period, instead of trying to return the value of the
current calculation from the previous period.

eg

IIF([Time].[Financial].CurrentMember.("Business Date Id") =
[Time].[Financial].[All
Time].FirstChild.FirstChild.FirstChild.FirstChild.First Child.Properties
("Business
Date Id"),
IIF(NOT ISEMPTY([Measures].[Selling Price Major]),
[Measures].[Selling Price Major],
0),
IIF(NOT ISEMPTY([Measures].[Selling Price Major]),
[Measures].[Selling Price Major],
([Time].[Financial].PrevMember,[Measures].[Selling Price Major]))
)


Let me know if this works for you.

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

In article <uUadV2luFHA.3452 (AT) TK2MSFTNGP14 (DOT) phx.gbl>,
deepak_puri (AT) progressive (DOT) com says...
Quote:
What if you use the "is" comparison, like:


IIF([Time].[Financial].CurrentMember is
[Time].[Financial].[All
Time].FirstChild.FirstChild.FirstChild.FirstChild.First Child,
CoalesceEmpty([Measures].[Selling Price Major]), 0),
IIF(NOT ISEMPTY([Measures].[Selling Price Major]),
[Measures].[Selling Price Major],
[Time].[Financial].PrevMember))



- Deepak

Deepak Puri
Microsoft MVP - SQL Server

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



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

Default Re: Infinite Recursion Error - 09-18-2005 , 02:42 AM



Sorry - scrap my last response. I did not realise that you were actually
trying to implement a recursive function.

Mosha did mention in his blog here
http://sqljunkies.com/WebLog/mosha/a...1/23/6811.aspx
that prior to SP3 the recursive stack used to run out at about 30 calls,
but after SP3 this was significantly increased. So I am not sure why you
would have issues if you have SP4 loaded.


In article <MPG.1d94eb6e848b1e28989699 (AT) news (DOT) microsoft.com>, Darren
Gosbell <dgosbell_at_yahoo_dot_com> says...
Quote:
I think the issue might be that in your "previous period" logic you are
not specifying which measure to use. It therefore uses the current
member in the measures dimension, which is the calculated measure itself
and results in "infinite" recursion.

What I think you need to do is to replace:

[Time].[Financial].PrevMember

with:

([Time].[Financial].PrevMember,[Measures].[Selling Price Major])

which will tell the formula to return the [Selling Price Major] measure
from the previous period, instead of trying to return the value of the
current calculation from the previous period.

eg

IIF([Time].[Financial].CurrentMember.("Business Date Id") =
[Time].[Financial].[All
Time].FirstChild.FirstChild.FirstChild.FirstChild.First Child.Properties
("Business
Date Id"),
IIF(NOT ISEMPTY([Measures].[Selling Price Major]),
[Measures].[Selling Price Major],
0),
IIF(NOT ISEMPTY([Measures].[Selling Price Major]),
[Measures].[Selling Price Major],
([Time].[Financial].PrevMember,[Measures].[Selling Price Major]))
)


Let me know if this works for you.




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.