Can anyone help with a basic Analysis Services cube question?

Here's the issue...

We're running SQL Server 2005 w/ all services.

We have a table called 'PartProduct' which has 3 columns: PartNumber, PartQty, and Product. The combination of PartNumber+Product is the key; a PartNumber can appear on many products, and a Product has many PartNumbers.

I can create a cube which shows me a pivottable with PartNumbers down the Y axis and Products across the X axis, so that I can compare how many of each Part is used on each Product. What I NEED, though, is a comparison how many Parts each Product has in common with other products, whether by the number of different parts or the sum of different parts:

Source Table:

PartNo PartQty Product

- -

PartA 4.0 ProductA

PartA 3.0 ProductB

PartA 4.0 ProductC

PartB 1.0 ProductA

PartB 1.0 ProductB

PartB 1.0 ProductC

PartC .5 ProductB

PartC .5 ProductA

PivotTable from a cube I've created:

PartNo ProductA ProductB ProductC

-- -- --

PartA 4.0 3.0 4.0

PartB 1.0 1.0 1.0

PartC .5 .5

What I need (#1 - total parts used between a pair of products; note that where a product crosses itself, the number of parts is doubled, since it's a pair of products):

Product ProductA ProductB ProductC

- -- -- --

ProductA 11.0 10.0 10.5

ProductB 10.0 9.0 9.5

ProductC 10.5 9.5 10.0

What I need (#2 - Number of different PartNumbers in a pair of products):

Product ProductA ProductB ProductC

- -- -- --

ProductA 3 3 2

ProductB 3 3 2

ProductC 2 2 2

I need a few other stats, but I think if someone can help me figure out how to generate these two tables, I can figure out the rest.

Any suggestions are DEEPLY appreciated. I'm an Analysis Services neophyte and I'm learning as fast as I can.

Thanks, all!

- Tom

[1818 byte] By [tculler] at [2007-12-24]
# 1

Before suggesting a solution, I should mention a discrepancy from your result #1 above - I got instead:

Product ProductA ProductB ProductC
- -- -- --
ProductA 11.0 10.0 10.0

ProductB 10.0 9.0 9.0
ProductC 10.0 9.0 10.0

I used a many-many dimension model, somewhat similar to the "Survey" scenario discussed in this paper:

http://www.sqlbi.eu/Home/tabid/36/ctl/Details/mid/374/ItemID/7/Default.aspx

>>

This is the introduction of a paper that describes how to leverage the many-to-many dimension relationships, a feature that debuted available with Analysis Services 2005.

After introducing the main concepts, the paper discusses various implementation techniques in the form of design patterns:

for each model, there is a description of a business scenario that could benefit from the model, followed by an explanation of its implementation.

...

>>

I created a named query alias for the original fact table, so that there are 2 measure groups, one on each copy of the fact table.

I also created PartNo and Product dimensions. A single role of the PartNo dimension directly relates to both measure groups,

but I added the Product dimension in 2 roles (Product1 and Product2), each role only directly relating to 1 measure group.

Then I added many-to-many relations between each Product role and its unrelated measure group (MeasureGroup1<-->Product2

via MeasureGroup2, and MeasureGroup2<-->Product1 via MeasureGroup1). In both MeasureGroup1 and MeasureGroup2,

I created a "PartQty" sum measure, and in MeasureGroup1 a "PartCount" count measure. PartQty1 + PartQty2 gives me result #1

(above). The PartCount matches your #2 (number of different PartNumbers in a pair of products).

DeepakPuri at 2007-8-31 > top of Msdn Tech,SQL Server,SQL Server Analysis Services...

SQL Server

Site Classified