dbTalk Databases Forums  

Total sum on calculated members

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


Discuss Total sum on calculated members in the microsoft.public.sqlserver.olap forum.



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

Default Total sum on calculated members - 02-22-2005 , 03:56 AM






Hi

I have build a cube with avarage values on measure, but I need on the Total
cell of dimension the sum of each single average value
like example ex1.

ex1. C
C1 C2 C3 C4 C5 Total
R1 1 3 4 2 1 11
R2 5 2 4 3 6 20


I try to do this with the following steps:
1) create a dimension "C" with level C1-C5
2) create a measure "m_R1" and "m_R2" that sum the values of columns R1 e
R2 from table T (R1 or R2 columns can contain a 0 value)
3) create measures "m_R1_rows" and "m_R2_rows" that sum a colums R1_ROW and
R2_ROW from table T ( these columns contains a value 1 when the correspond
columns R1 o R2 containt a value greater of 0)
4) create calculate members "R1" and "R2" with this formula Iif(
[Measures].[m_R1_rows] = 0, Null, [Measures].[m_R1] /
[Measures].[m_R1_rows])

This work fine for each level, but on Total of dimension I have a average
value of rows R1 and R2 (see ex2 example)

ex2. C
C1 C2 C3 C4 C5 Total
R1 1 3 4 2 1 2
R2 5 2 4 3 6 4


Is possible for Total dimension have a sum of each value of level like ex1?
If yes how..?

Thanks in advance.

Simon.



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

Default Re: Total sum on calculated members - 02-22-2005 , 09:49 PM






How about if you define [R1] as follows:

Quote:
With Member [Measures].[R1] as
'Iif(IsLeaf(Descendants([C].CurrentMember),
Iif([Measures].[m_R1_rows] = 0, Null,
[Measures].[m_R1] / [Measures].[m_R1_rows]),
Sum(Descendants([C].CurrentMember,,LEAVES),
[Measures].[R1]))'
Quote:

- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


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.