我正在使用带有Adventure Works DW的MSAS 2008。这是我想要使用MDX查询获得的切片的结构:
我一直在创建一个查询来从Product Categories层次结构中获取前2名成员。问题是我不知道如何为[Product]。[Style]层次结构创建新计算的Total成员。使用下面的查询,我只能为[Product]。[Product Categories]层次结构创建Total成员,但我尝试获得Style层次结构的总数失败。
WITH
SET [Product Color (set)] as 'DRILLDOWNLEVEL(
{[Product].[Color].[All Products]}
)'
SET [Top 2 Categories For Each Style (set)] as 'GENERATE(
[Product].[Style].[Style],
TOPCOUNT(
([Product].[Style].CURRENTMEMBER, [Product].[Product Categories].[Category]),
2,
[Measures].[Discount Amount]
) + ([Product].[Style].CURRENTMEMBER, [Product].[Product Categories].[Total])
)'
SET [Product Style (set)] as 'DRILLDOWNLEVEL(
{[Product].[Style].[All Products]}
)'
SET [rowSet] AS '[Top 2 Categories For Each Style (set)] *
{
[Measures].[Discount Amount],
[Measures].[Reseller Order Quantity]
}'
SET [columnSet] as '[Product Color (set)]'
member [Product].[Product Categories].[Total] as 'AGGREGATE(
TOPCOUNT(
([Product].[Style].CURRENTMEMBER, [Product].[Product Categories].[Category]),
2,
[Measures].[Discount Amount]
)
)'
SELECT
[rowSet] ON ROWS,
[columnSet] ON COLUMNS
FROM [Adventure Works] CELL PROPERTIES VALUE
任何建议都将受到赞赏。