dbTalk Databases Forums  

Someone please help...

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


Discuss Someone please help... in the microsoft.public.sqlserver.olap forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sk_rosacea@hotmail.com
 
Posts: n/a

Default Someone please help... - 07-06-2005 , 09:55 AM






Hi,

I'm trying to get the following query working and its driving me mad.
Can someone please give me a hand.

Here is what I have which almost gives me what I want:

WITH
SET [Selection] AS '{[Product].[Product].Members}'
MEMBER [Product].[TOTAL] AS 'AGGREGATE([Selection])'
SET [ProductRecovery] AS '{
GENERATE(DESCENDANTS([Product].[ProductGroup].&[1],[Product].[Product]),{([RecoveryRate].[All
RecoveryRate],[RecoveryRateDiff].[100])}),
GENERATE(DESCENDANTS([Product].[ProductGroup].&[2],[Product].[Product]),{([RecoveryRate].[25],[RecoveryRateDiff].[All
RecoveryRateDiff])})}'
MEMBER [Measures].[Val1] AS '
SUM (
[ProductRecovery],[Measures].[Measure1]
)'

SELECT {Val1} ON COLUMNS,
NON EMPTY
CROSSJOIN({[Product].[TOTAL],[Selection]},[DEMeasure].[Measure].Members)
ON ROWS
FROM DefaultExposure
WHERE ([BusinessDate].[2005-07-04 00:00:00],
[IssuerIndustry].[Issuer].&[1380087])

The problem is the numbers it produces are wrong and I suspect that the
error is with the [ProductRecovery] set and how I use it.

Basically the intention is to select either a [recovery rate] or a
[recovery rate diff] (but not both) for each of the two productgroups
and then to sum over these values.

Unfortunately, it doesn't produce the right numbers so something is
going wrong.

In a nutshell my question is this:

If I have three separate dimensions (called A,B and X), how do I
aggregate in such a way that I either get [All A] and [a single Item
from B] or [a Single Item from A] and [All B] depending on
X.CurrentMember.

I expect this is really easy, but my background is SQL and I am still
getting my head round the MDX approach. Any help is really
appreciated.

If its not clear what I am getting at please tell me.

Thanks,
Seth


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

Default Re: Someone please help... - 07-06-2005 , 09:16 PM






Hi Seth,

I can't quite map the MDX query to your (simpler) problem description,
so some sample data would help clarify this. My initial interpretation
is this MDX query:

Quote:
WITH
SET [Selection] AS '{[Product].[Product].Members}'
MEMBER [Product].[TOTAL] AS 'SUM([Selection])',
SOLVE_ORDER = 5
MEMBER [Measures].[Val1] AS
'iif(IsAncestor(Product].[ProductGroup].&[1],
[Product].CurrentMember),
([RecoveryRate].[All RecoveryRate],
[RecoveryRateDiff].[100],
[ProductRecovery],[Measures].[Measure1]),
([RecoveryRate].[25],
[RecoveryRateDiff].[All RecoveryRateDiff],
[ProductRecovery],[Measures].[Measure1]))'

SELECT {Val1} ON COLUMNS,
NON EMPTY
CROSSJOIN({[Product].[TOTAL],[Selection]},[DEMeasure].[Measure].Members)
ON ROWS
FROM DefaultExposure
WHERE ([BusinessDate].[2005-07-04 00:00:00],
[IssuerIndustry].[Issuer].&[1380087])
Quote:

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