dbTalk Databases Forums  

Need to match description to hierarchy key field

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


Discuss Need to match description to hierarchy key field in the microsoft.public.sqlserver.olap forum.



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

Default Need to match description to hierarchy key field - 08-26-2004 , 09:25 PM






Hi. I need to report on all 2004 sales by product. It sounds easy
enough, but the products are hierarchical and I have to report on
starting with the top level and working my way down to the last child
in the hierarchy, showing sales for each level.

So, here's my dilemma...

I can use the MDX query below to retrieve all 2004 sales (broken down
by month) by crossjoining the time dimension with my product hierarchy
dimension. Unfortunately, since the hierarchy consists of key values
and not descriptions, I need to also retrieve the descriptions (names
of the products). When I wrote my MDX query, I cross-joined the time
dimension with my product hierarchy, which was fine, but I couldn't
figure out how to also retreive the corresponding product description
without doing another cross-join (as shown below). There is a
one-to-one relationship between the hieararchy member and the
corresponding description member.

MDX query that gets the extra cross join:
SELECT { [Measures].[Amt Sold zero-filled], [Measures].[Num Sold
zero-filled] } ON COLUMNS,
{YTD([TimeDimension].[2003].[Quarter 4].[December]) *
[ProdHierarchy].[Level 04].ALLMEMBERS * [Prod
Description].[Description].ALLMEMBERS }
DIMENSION PROPERTIES MEMBER_CAPTION ON ROWS
FROM [Sales]

As you see, I'm cross-joining too many things. I don't want to
cross-join the Product Description with the ProdHierarchy members. I
just want a one-to-one match. How do I do that? Once I figure this
out, I'll also want to retrieve the product ID, which is also a
one-to-one match, but I can add that once I get the methodology right.

By the way, my product hierarchy is a parent-child dimension, which
comes from my Products table. The Products table is keyed by ProdNum
and has a parent of ParentProdNum. The ProdNum is no value in the
report I'm building, so I need the Description and ProdID fields for
my report rows in place of the ProdNum values. That's why my MDX
query needs to retrieve the corresponding description info for my
hierarchy-based ProdNum values.

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.