dbTalk Databases Forums  

VERY complex MDX question

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


Discuss VERY complex MDX question in the microsoft.public.sqlserver.olap forum.



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

Default VERY complex MDX question - 11-18-2004 , 03:56 PM






Hi,

I've had this problem in OLAP for 3 weeks now, and I haven't found a
solution for it yet.

I have the following 5 Dimensions:
Line, Product, Store, Reporting Centre, and Legal Entity.

Every Product belongs to a Reporting Centre, where there could be many
Products that belong to the same Reporting Centre, but only one
Reporting Centre for each Product.

Every Store belongs to a Reporting Centre, where there could also be
many Stores that belong to the same Reporting Centre, but only one
Reporting Centre for each Store.

Now, each Reporting Centre has a specific tax rate, which is stored in
Line [9199]. But Products, Stores, and Legal Entity do not have a tax
rate, but have an Income amount, which is Line [2001].

If I'm in the cube looking at a specific Product (ie P1111), I have to
calculate the tax amount on the Income that P1111 has, but since
Products do NOT have a tax rate (Line 9199 is NULL for them), I would
like to use the tax rate that belongs to the Reporting Centre that
Product P1111 belongs to.

I have no clue how to code this in MDX, and any help or solution to
this problem will be greatly appreciated.

Thanks

Hichem

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

Default Re: VERY complex MDX question - 11-18-2004 , 06:12 PM






You didn't say what measures are in the cube, but assuming generic
measures exist, like [Amount] and [LineCount]:

Quote:
With Member [Measures].[ProductTaxRate] as
'Avg(NonEmptyCrossJoin(
[Reporting Centre].[ReportingCentreID].Members,
{[Product].CurrentMember}, 1),
([Measures.[Amount], [Line].[9199])
/([Measures.[LineCount], [Line].[9199]))'
Member [Measures].[ProductTaxAmount] as
'[Measures].[ProductRate] *
([Measures].[Amount], [Line].[2011])'

Select {[Measures].[ProductTaxRate],
[Measures].[ProductTaxAmount]} on columns,
{[Product].[P1111]} on rows
from [YourCube]
Quote:

- Deepak

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


Reply With Quote
  #3  
Old   
luminary
 
Posts: n/a

Default RE: VERY complex MDX question - 11-22-2004 , 03:03 PM



If it were me, I'd simplify the question by denormalising the source data and
include the tax rate as a Product dimension attribute.

hth

"Hichem" wrote:

Quote:
Hi,

I've had this problem in OLAP for 3 weeks now, and I haven't found a
solution for it yet.

I have the following 5 Dimensions:
Line, Product, Store, Reporting Centre, and Legal Entity.

Every Product belongs to a Reporting Centre, where there could be many
Products that belong to the same Reporting Centre, but only one
Reporting Centre for each Product.

Every Store belongs to a Reporting Centre, where there could also be
many Stores that belong to the same Reporting Centre, but only one
Reporting Centre for each Store.

Now, each Reporting Centre has a specific tax rate, which is stored in
Line [9199]. But Products, Stores, and Legal Entity do not have a tax
rate, but have an Income amount, which is Line [2001].

If I'm in the cube looking at a specific Product (ie P1111), I have to
calculate the tax amount on the Income that P1111 has, but since
Products do NOT have a tax rate (Line 9199 is NULL for them), I would
like to use the tax rate that belongs to the Reporting Centre that
Product P1111 belongs to.

I have no clue how to code this in MDX, and any help or solution to
this problem will be greatly appreciated.

Thanks

Hichem


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.