dbTalk Databases Forums  

Conditional Filtering with Calculated Members

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


Discuss Conditional Filtering with Calculated Members in the microsoft.public.sqlserver.olap forum.



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

Default Conditional Filtering with Calculated Members - 11-01-2004 , 07:29 AM






I am trying to set up a calculated member in analysis services that
calculates differently dependant on the selected dimension value.

For example.

If I have a calculated measure of say PercentageSold that is calculated from
my two measures Sold and Available. Then I would like to be able to exclude
any sold items that fell into the dimension SellType of 'Complimentary'.

The basic pseudo code is something like IIF(SellType = 'Complimentary', 0 ,
Sold/Available )

I have tied to use Filter, Except, and IIF in my MDX to no avail.

Please note that other calculations do include any sold items or any
available items, and so it is not a case of simply scrubbing the data. I
know that I can fudge it by having an extra column in the data that just
shows Non Complimentary values, but this doesn't seem a very clean solution.

Any help would be much appreciated.

Thanks in advance

Regards
Tony



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

Default Re: Conditional Filtering with Calculated Members - 11-01-2004 , 01:15 PM






Assuming that [Measures].[Sold] has sum/count aggregation:
Quote:
With Member [Measures].[PercentageSold] as
'([Measures].[Sold]
- ([Measures].[Sold],[SellType].[Complimentary]))
/[Measures].[Available]',
FORMAT_STRING='PERCENT'
Quote:

- Deepak

*** 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.