dbTalk Databases Forums  

Need to Rollup Ending Balance

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


Discuss Need to Rollup Ending Balance in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Nathan Reichner via SQLMonster.com
 
Posts: n/a

Default Need to Rollup Ending Balance - 03-30-2005 , 09:38 PM






I have a cube that has an amount measure (dollars), a time dimension(Month,
Qtr, Year) and an account dimension(Acct Category, Acct). For one account
I need to show the ending balance for the quarter rather than the sum of
the months for that account.

It looks like this if I do nothing:

Jan Feb Mar Q1
Account1 20 15 10 45
Account2 30 25 15 70

But I need it to like this:

Jan Feb Mar Q1
Account1 20 15 10 10
Account2 30 25 15 70

And this applies to only certain accounts in the account dimension, like
account1, and the others need to have the months summed up into the
quarter, like account2.

Any help would be much appreciated.

--
Message posted via http://www.sqlmonster.com

Reply With Quote
  #2  
Old   
Martin
 
Posts: n/a

Default RE: Need to Rollup Ending Balance - 03-31-2005 , 02:33 AM






Hi Nathan

Well, you can always work with the lastchild functionality in a calculated
member, for example (if time dimension only has three levels, year, quarter
and month)

iif(isgeneration([time], 1),
([measures].[id], [time].lastchild),
[measures].[id])

What this says is that if the time dimension is on quarter level it shall
take the value of the last child in that dimension(that will be march, june,
september or december).

Best regards

/Martin

"Nathan Reichner via SQLMonster.com" wrote:

Quote:
I have a cube that has an amount measure (dollars), a time dimension(Month,
Qtr, Year) and an account dimension(Acct Category, Acct). For one account
I need to show the ending balance for the quarter rather than the sum of
the months for that account.

It looks like this if I do nothing:

Jan Feb Mar Q1
Account1 20 15 10 45
Account2 30 25 15 70

But I need it to like this:

Jan Feb Mar Q1
Account1 20 15 10 10
Account2 30 25 15 70

And this applies to only certain accounts in the account dimension, like
account1, and the others need to have the months summed up into the
quarter, like account2.

Any help would be much appreciated.

--
Message posted via http://www.sqlmonster.com


Reply With Quote
  #3  
Old   
Nathan Reichner via SQLMonster.com
 
Posts: n/a

Default RE: Need to Rollup Ending Balance - 03-31-2005 , 09:33 PM



Martin,

Thanks for your reply. What I am trying to do is change the rollup
behavior of the amount measure for certain accounts only. So the MDX
statement below doesn't tell me how I can limit the lastchild to a
particular account. Also, the cube is accessed via the PivotTable Service
in Excel so I am thinking that the logic needs to be a custom rollup
formuala and not a calculated member.

Thanks in advance.

--
Message posted via http://www.sqlmonster.com

Reply With Quote
  #4  
Old   
Martin
 
Posts: n/a

Default RE: Need to Rollup Ending Balance - 04-01-2005 , 01:19 AM



Hi again Nathan

First, there is no reason why you can't use Calculated members when you use
excel as front end to user. They are shown just as any measure.

But if you still want it to be a custom rollup it is possible as well. Go
into the quarter level of the time dimension and edit the Custom rollup
formula (in the advanced tab of the properties):

Use something like this:
IIf(membertostr([Account].CurrentMember) = "[Account].[Account
Name].&[Whatever account you have]",
[Time].CurrentMember.LastChild,
RollupChildren([Time].CurrentMember, "+"))

The last row is used just to sum up the values if not in one of the excluded
accounts. I you want to use the operators that you use normally you can use

RollupChildren([Time].CurrentMember,
[Time].CurrentMember.Properties("UNARY_OPERATOR"))

instead of the last row

This according to the sql-help but I havent tested this.

Good luck

/Martin


"Nathan Reichner via SQLMonster.com" wrote:

Quote:
Martin,

Thanks for your reply. What I am trying to do is change the rollup
behavior of the amount measure for certain accounts only. So the MDX
statement below doesn't tell me how I can limit the lastchild to a
particular account. Also, the cube is accessed via the PivotTable Service
in Excel so I am thinking that the logic needs to be a custom rollup
formuala and not a calculated member.

Thanks in advance.

--
Message posted via http://www.sqlmonster.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.