WITH
SET [AAA] AS ' FILTER([Product].Members, IsLeaf([Product].CurrentMember)=1) '
MEMBER [MEASURES].[BBB] AS ' IIF([Measures].[Store Sales] >10,[Measures].[Store Sales],0) ',solve_order=1
MEMBER [MEASURES].[CCC] AS 'SUM( { Descendants( [Time].[1997],2 )},[BBB] )',solve_order=2
MEMBER [MEASURES].[DDD] AS 'SUM( {[AAA]},[CCC] )',solve_order=3
WITH
SET [AAA] AS ' FILTER([Product].Members, IsLeaf([Product].CurrentMember)=1) '
MEMBER [MEASURES].[BBB] AS ' IIF([Measures].[Store Sales] >10,[Measures].[Store Sales],0) ',solve_order=1
MEMBER [MEASURES].[CCC] AS 'SUM( { Descendants( [Time].[1997],2 )},[Measures].[Store Sales] )',solve_order=2
MEMBER [MEASURES].[DDD] AS 'SUM( {[AAA]},[CCC] )',solve_order=3
WITH
--取产品叶
SET [AAA] AS ' FILTER([Product].Members, IsLeaf([Product].CurrentMember)=1) '
--如果 Store Sales >10,则 为Store Sales,否则,0
MEMBER [MEASURES].[BBB] AS ' IIF([Measures].[Store Sales] >10,[Measures].[Store Sales],0) '
--统计1997年 Store Sales >10 的总和
MEMBER [MEASURES].[CCC] AS 'SUM( { Descendants( [Time].[1997],2 )},[BBB] )'
[Quote=引用 11 楼 MSTOP 的回复:]
WITH MEMBER 是对度量的.
WITH SET 是对维的.
按你标题的意思,统计的是客户维,当然是 SET 了.
[/Quote]
这种说话我认为不对, 度量也是一个维, WITH MEMBER并不只是能够针对这个维度.
WITH MEMBER 只是定义一个成员,虽然大多数情况下用以定义计算成员,在Measures维度下面。但是他也可以定义其他维下面的成员。
WITH SET 是定义一个集,成员集元组集都行,他也可以应用于度量维。
比如这个查询:
with
member [Customer].[Customer Geography].[北美] as [Customer].[Customer Geography].[Country-Region].&[Canada] + [Customer].[Customer Geography].[Country-Region].&[United States], SCOPE_ISOLATION = CUBE
set [xxx] as {[Measures].[Total Sales Amount], [Measures].[Total Product Cost]}
select
[xxx] on 0,
{[Customer].[Customer Geography].[北美],
[Customer].[Customer Geography].[Country-Region].&[Canada], [Customer].[Customer Geography].[Country-Region].&[United States]} on 1
from [Analysis Services Tutorial]