两种不同标准的相同测量

时间:2013-12-03 21:39:06

标签: reporting-services sql-server-2012 mdx

目标:
名为“经销商订单计数”的第二个测量(未在列表中应用)应仅在性别和国家/地区的表格中过滤。
剩余的测量结果“经销商订单数”和“折扣金额”不受性别影响,仅受“国家”影响。

问题:
我不知道怎么做。我试过但失败了。

信息:
*国家/地区应用于DataSet2数据 *您使用参数来过滤值
*我使用SSAS作为数据源
*数据源是Adventurework DW2012 multi。
*您可以选择值作为参数以在列表中进行过滤。

enter image description here

WITH MEMBER 
    [Measures].[ParameterCaption] AS [Employee].[Gender].CURRENTMEMBER.MEMBER_CAPTION MEMBER 
    [Measures].[ParameterValue] AS [Employee].[Gender].CURRENTMEMBER.UNIQUENAME MEMBER 
    [Measures].[ParameterLevel] AS [Employee].[Gender].CURRENTMEMBER.LEVEL.ORDINAL 

    SELECT 
    {
    [Measures].[ParameterCaption], 
    [Measures].[ParameterValue], 
    [Measures].[ParameterLevel]
    } 
    ON COLUMNS , 

    [Employee].[Gender].CHILDREN ON ROWS 

FROM [Adventure Works]



WITH MEMBER 
    [Measures].[ParameterCaption] AS [Geography].[Country].CURRENTMEMBER.MEMBER_CAPTION MEMBER 
    [Measures].[ParameterValue] AS [Geography].[Country].CURRENTMEMBER.UNIQUENAME MEMBER 
    [Measures].[ParameterLevel] AS [Geography].[Country].CURRENTMEMBER.LEVEL.ORDINAL 

    SELECT 
    {
    [Measures].[ParameterCaption], 
    [Measures].[ParameterValue], 
    [Measures].[ParameterLevel]
    } 
    ON COLUMNS , 

    [Geography].[Country].ALLMEMBERS ON ROWS 

FROM [Adventure Works]



SELECT
{ 
    [Measures].[Reseller Order Count], 
    [Measures].[Discount Amount] 
} ON COLUMNS, 
{ 
    ([Reseller].[Reseller Type].[Business Type].ALLMEMBERS ) 
} ON ROWS 
FROM 
( 
    SELECT ( STRTOSET(@Countries, CONSTRAINED) ) ON COLUMNS 
    FROM [Adventure Works]
)

1 个答案:

答案 0 :(得分:0)

将以下代码应用于上面的源代码

WITH
SET Day
AS StrToSet (@Gender)

Member [Measures].[Measures].[Discount Amount - intakt]
AS Sum ( Day , [Measures].[Discount Amount] )

它实现了目标!