我必须使用[ZONE]。[MY_ZONE_1] ON ROWS因为这是一组名称不同的区域,以&#34开头;以MY_ZONE_1"开头的区域我过滤并设置为[FILTERED ZONE] 我需要在[ZONE]。[MY_ZONE_1]中显示库存中可用的产品(最小1件)但在[ZONE]中没有库存。[MY_ZONE_2]。所以我在这里用来过滤结果的维度是[ZONE]。[MY_ZONE_1],但不能按[ZONE]。[MY_ZONE_2]进行过滤,因为我不能在2个不同的地方使用维度[ZONE]轴。
类似的东西:
选择article_code
其中(stock_in_zone1> = 1)&& (stock_in_zone2为null或= 0)
WITH
SET [FILTERED ZONE] AS
{
{
Filter
(
[ZONE].[ZONE].MEMBERS
,
Instr
(
[ZONE].[ZONE].CurrentMember.Name
,"a zone that starts with MY_ZONE_1"
)
> 0
)
}
}
MEMBER [Measures].[AVAILABLE STOCK] AS
IIF
(
[Measures].[STOCK] < 1
,null
,[Measures].[STOCK]
)
SELECT
NON EMPTY
{[Measures].[AVAILABLE STOCK]} ON 0
,NON EMPTY
CrossJoin
(
[FILTERED ZONE]
,[ARTICLE CODE].[ARTICLE CODE].MEMBERS
) ON 1
FROM [MyCube];
答案 0 :(得分:1)
我倾向于违反保持简单的规则,但希望你能够了解我如何将事情分解成几套以试图提供帮助:
WITH
SET [AllArtCodes] AS
[ARTICLE CODE].[ARTICLE CODE].MEMBERS
SET [AllArtCodes_zone1Greater1] AS //<<to find the article codes in zone 1 with [Measures].[STOCK] >= 1
Filter
(
NonEmpty
(
[AllArtCodes]
,[ZONE].[MY_ZONE_1]
)
,
[Measures].[STOCK] >= 1
)
SET [AllArtCodes_zone2nullZero] AS //<<to find the article codes in zone 2 with [Measures].[STOCK] = 0 (this should cover the null option as well)
Filter
(
NonEmpty
(
[AllArtCodes]
,[ZONE].[MY_ZONE_2]
)
,
[Measures].[STOCK] = 0
)
SET [intersectAbove] AS //<< narrow to common members of above two custom sets
Intersect
(
[AllArtCodes_zone1Greater1]
,[AllArtCodes_zone2nullZero]
)
SET [FILTERED ZONE] AS
{
{
Filter
(
[ZONE].[ZONE].MEMBERS
,
Instr
(
[ZONE].[ZONE].CurrentMember.Name
,"a zone that starts with MY_ZONE_1"
)
> 0
)
}
}
MEMBER [Measures].[AVAILABLE STOCK] AS
IIF
(
[Measures].[STOCK] < 1
,null
,[Measures].[STOCK]
)
SELECT
NON EMPTY
{[Measures].[AVAILABLE STOCK]} ON 0
,NON EMPTY
[FILTERED ZONE] * [intersectAbove] ON 1 //<<filtered set here
FROM [MyCube];