dbTalk Databases Forums  

Conditional calculated members

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


Discuss Conditional calculated members in the microsoft.public.sqlserver.olap forum.



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

Default Conditional calculated members - 10-07-2003 , 05:44 AM






I've been working in the OLAP field for a while but I'm fairly new to
Analysis Services and my knowledge of MDX leaves something to be desired.
With this in mind, here's my question:

Is it possible to create a calculated member whose value changes depending
on a member property of a different dimension?


For example:

Suppose I have a (parent-child) Accounts dimension with a member property
'IsUnit' (values Y/N). My fact table contains both cash values and unit
values. Suppose I also have a 'Scenario' dimension with members 'Cash' and
'Units' which seperates Cash and Unit values for reporting purposes.

A particular account can have both cash and unit values in the fact table,
cash will be keyed with the Cash scenario, unit values with the Units
scenario.

Now suppose I want to combine the cash and units scenarios into a combined
'Mixed' scenario which displays the unit value for certain unit accounts and
the cash value for other, non-unit, accounts. The type of account is defined
by the 'IsUnit' member property in the Accounts dimension. I want a
calculated member 'Mixed' in the Scenario dimension with this behaviour:

Where account member property 'IsUnit'='Y', Mixed value= Units value
Where account member property 'IsUnit'='N', Mixed value= Cash value

Example fact data:

Account Scenario Value
-------------------------------
Cola Cash 10000
Cola Units 5000
Juice Cash 5400
Juice Units 270
Gross Profit Cash 4500000
Gross Profit Units 123500

Account table data:

Account IsUnit
---------------------
Cola Y
Juice Y
Gross Profit N

Values of Mixed scenario:
Cola 5000 (Unit value)
Juice 270 (Unit value)
Gross Profit 4500000 (Cash value)


Any suggestions on how to achieve this would be very gratefully received!

Thank-you in advance,
James Taylor



Reply With Quote
  #2  
Old   
Brian Altmann
 
Posts: n/a

Default Conditional calculated members - 10-07-2003 , 07:22 AM






You can define a calculated member of the Scenario
dimension:

iif([Accounts].currentmember.properties('isunit')='Y',
[scenario].[units],[scenario].[cash])

(Syntax not checked)

HTH,
Brian
www.geocities.com/brianaltmann/olap.html




Quote:
-----Original Message-----
I've been working in the OLAP field for a while but I'm
fairly new to
Analysis Services and my knowledge of MDX leaves
something to be desired.
With this in mind, here's my question:

Is it possible to create a calculated member whose value
changes depending
on a member property of a different dimension?


For example:

Suppose I have a (parent-child) Accounts dimension with a
member property
'IsUnit' (values Y/N). My fact table contains both cash
values and unit
values. Suppose I also have a 'Scenario' dimension with
members 'Cash' and
'Units' which seperates Cash and Unit values for
reporting purposes.

A particular account can have both cash and unit values
in the fact table,
cash will be keyed with the Cash scenario, unit values
with the Units
scenario.

Now suppose I want to combine the cash and units
scenarios into a combined
'Mixed' scenario which displays the unit value for
certain unit accounts and
the cash value for other, non-unit, accounts. The type of
account is defined
by the 'IsUnit' member property in the Accounts
dimension. I want a
calculated member 'Mixed' in the Scenario dimension with
this behaviour:

Where account member property 'IsUnit'='Y', Mixed value=
Units value
Where account member property 'IsUnit'='N', Mixed value=
Cash value

Example fact data:

Account Scenario Value
-------------------------------
Cola Cash 10000
Cola Units 5000
Juice Cash 5400
Juice Units 270
Gross Profit Cash 4500000
Gross Profit Units 123500

Account table data:

Account IsUnit
---------------------
Cola Y
Juice Y
Gross Profit N

Values of Mixed scenario:
Cola 5000 (Unit value)
Juice 270 (Unit value)
Gross Profit 4500000 (Cash value)


Any suggestions on how to achieve this would be very
gratefully received!

Thank-you in advance,
James Taylor


.


Reply With Quote
  #3  
Old   
James Taylor
 
Posts: n/a

Default Re: Conditional calculated members - 10-07-2003 , 10:03 AM



That is a beautiful thing.

Thank you.

Quote:
You can define a calculated member of the Scenario
dimension:

iif([Accounts].currentmember.properties('isunit')='Y',
[scenario].[units],[scenario].[cash])

(Syntax not checked)

HTH,
Brian
www.geocities.com/brianaltmann/olap.html



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.