SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Calculated member formula for All member is not SUM of children


Calculated member formula for All member is not SUM of children

Author
Message
cliffb
cliffb
SSC Eights!
SSC Eights! (803 reputation)SSC Eights! (803 reputation)SSC Eights! (803 reputation)SSC Eights! (803 reputation)SSC Eights! (803 reputation)SSC Eights! (803 reputation)SSC Eights! (803 reputation)SSC Eights! (803 reputation)

Group: General Forum Members
Points: 803 Visits: 438
Hello everyone,
I am working on a proof of concept to move some heavy analytical calculations into SSAS. Everything was working fine until I hit a particularly complex calculation. What appears to be occuring is the children are SUMMED correctly, but the All member is not.

Psuedo code
MEMBER Measures.x AS

SUM(
[Dimension].[Attribute]
,
CASE
WHEN [Measures].[Cost] > 0 AND ([Measures].[Measure1]*[Measures].[Measure2]*[Measures].[Measure3])/[Measures].[Cost] > 5 THEN
[Measures].[Cost]/([Measures].Measure1*[Measures].[Measure3])
ELSE [Measures].[Measure2]
END)



I understand why it is happening, It's taking the values of the All member for the measures vs summing the result of the children. The question is how do I get the sum of the CHILDREN for All vs the calculation of the values of the All member?

FYI, I have tried adding a Calculation in the cube and processed it, but I got the exact same result.

Any help is appreciated.



cliffb
cliffb
SSC Eights!
SSC Eights! (803 reputation)SSC Eights! (803 reputation)SSC Eights! (803 reputation)SSC Eights! (803 reputation)SSC Eights! (803 reputation)SSC Eights! (803 reputation)SSC Eights! (803 reputation)SSC Eights! (803 reputation)

Group: General Forum Members
Points: 803 Visits: 438
Nevermind, I found what I needed.

For the Set argument, I used a case statement.

SUM(
CASE [Dimension].[Attribute].CURRENTMEMBER
WHEN [Dimension].[Attribute].[All] THEN [Dimension].[Attribute].CURRENTMEMBER.CHILDREN
ELSE [Dimension].[Attribute].CURRENTMEMBER
END,
...
)



write2mmk14
write2mmk14
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 0
Thanks for posting the solution.It was a life saver! I had a similar problem and being an MDX newbie, was breaking my head to find the solution..
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search