dbTalk Databases Forums  

How to get PostiveABSolute and otsum

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


Discuss How to get PostiveABSolute and otsum in the microsoft.public.sqlserver.olap forum.



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

Default How to get PostiveABSolute and otsum - 05-22-2006 , 04:19 PM






Hi

If I have a MDX query like

select {[Measures].[Amount] } on columns,
{ [Dim location].[name].members } on rows
from myCube

and each Measure Amount can be postive, negative or 0 the above returns
the net amount. How do I return the

net, positive (only the sum of postive measure values), negative (only
the sum of negative measure values) and absolute (sum of absolute
values)?

Thank you

Adrian


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

Default Re: How to get PostiveABSolute and otsum - 05-22-2006 , 06:02 PM






Hi Adrian,

If you need to roll up the positive, negative and absolute amounts from
the fact level up, you might want to add named calculations (AS 2005) to
the fact table, like:

Pos Amt: case when Amount > 0 then Amount else 0 end

Neg Amt: case when Amount < 0 then Amount else 0 end

Abs Amt: abs(Amount)

Then define "sum" measures on these fields.


- Deepak

Deepak Puri
Microsoft MVP - SQL Server

*** Sent via Developersdex http://www.developersdex.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.