dbTalk Databases Forums  

Sorting by calculated member

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


Discuss Sorting by calculated member in the microsoft.public.sqlserver.olap forum.



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

Default Sorting by calculated member - 09-02-2003 , 05:49 AM







Hi,



I have a calculated member which calculates the percentage of the total
of the column using this formula



[Measures].[Number of Cases]/(Sum(strtoset("Axis
(1)"),[Measures].[Number of Cases]))



This works pretty good, apart from the fact, that an error occurs as
soon as I want to sort by any column.

Error message as follows



CellSet.Open Error: Infinite recursion detected during execution of
calculated member Percentage by column.



This is the order-statement:

MDX: SELECT NON EMPTY {Descendants([Call].[All
Call],1,leaves),([Call].[All Call])} ON COLUMNS, Non Empty
{ORDER(Descendants([Time].[All Time],1,leaves),([Call].[All
Call]),BDesc),[Time].[All Time]} ON ROWS FROM [CTL_Cube] WHERE
(Measures.[Percentage by column])



Any ideas?



Thanks in advance


--
Posted via http://dbforums.com

Reply With Quote
  #2  
Old   
Brian Altmann
 
Posts: n/a

Default Sorting by calculated member - 09-02-2003 , 08:19 AM






The order function needs to use the calculated member. At
this point Axis(1) is not defined yet. The calc member
expression triggers the rows expression to define Axis(1)
which in turn calls the calc member expression again and
so on...

You donīt know the order but you do know which members you
want to display on rows, so you could replace the strtoset
("axis(1)") expression with :

{Descendants([Time].[All Time],1,leaves),[Time].[All Time]}

and your query should work.

HTH,
Brian
www.geocities.com/brianaltmann/olap.html

Quote:
-----Original Message-----

Hi,



I have a calculated member which calculates the
percentage of the total
of the column using this formula



[Measures].[Number of Cases]/(Sum(strtoset("Axis
(1)"),[Measures].[Number of Cases]))



This works pretty good, apart from the fact, that an
error occurs as
soon as I want to sort by any column.

Error message as follows



CellSet.Open Error: Infinite recursion detected during
execution of
calculated member Percentage by column.



This is the order-statement:

MDX: SELECT NON EMPTY {Descendants([Call].[All
Call],1,leaves),([Call].[All Call])} ON COLUMNS, Non
Empty
{ORDER(Descendants([Time].[All Time],1,leaves),
([Call].[All
Call]),BDesc),[Time].[All Time]} ON ROWS FROM
[CTL_Cube] WHERE
(Measures.[Percentage by column])



Any ideas?



Thanks in advance


--
Posted via http://dbforums.com
.


Reply With Quote
  #3  
Old   
Pumuckel
 
Posts: n/a

Default Re: Sorting by calculated member - 09-02-2003 , 10:36 AM




Thanks for the hint.

That's what I've assumed.



The problem is, that I don't know the members I want to display on rows
(the code was just an example), because the calculated member is a
measure valid for all dimensions. If I hardcode the member, I would have
to build up a calculated member for each dimension. Please correct me if
I'm wrong.



Isn't there a possibility to create axis(1) first and then sort
that dataset?



Regards


--
Posted via http://dbforums.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.