SSAS 计算和 MDX
SSAS Calculation & MDX
我不知道如何将此 SSAS 计算表达式转换为 MDX 查询,以便我可以评估计算的各个部分。请帮忙!
计算应用于维度为:年、月、商店、部门和帐户的多维数据集。它还有 1 个名为 Amount 的度量。
计算表达式如下:
(
([Accounts].[All Levels].[Level 1].&[Gross Profit].&[Dept1],[Measures].[Amount])+
([Accounts].[All Levels].[Level 1].&[Gross Profit].&[Dept2],[Measures].[Amount])
)
/
(
([Accounts].[All Levels].[Level 1].&[Labor],[Measures].[Amount])+
([Accounts].[All Levels].[Level 1].&[Expenses],[Measures].[Amount])
)
它基本上只是尝试仅获取部门 1 和 2 的毛利润,然后将其除以人工和费用(所有部门)的总和。
这将针对年、月和商店 selected(或总共)完成。
现在,我想要做的是查看立方体中不同维度所看到的最终结果的组成部分,以便我可以验证计算结果。
例如,如果我 select 年:2018 年,月:1 月:商店:L001。假设结果金额为 40%。
我想看看毛利润(部门 1 和部门 2)的金额与人工和费用的金额是多少。表示实际基础金额,但详细
我试过只放入计算表达式:
select
(
([Accounts].[All Levels].[Level 1].&[Gross Profit].&[Dept1],[Measures].[Amount])+
([Accounts].[All Levels].[Level 1].&[Gross Profit].&[Dept2],[Measures].[Amount])
)
/
(
([Accounts].[All Levels].[Level 1].&[Labor],[Measures].[Amount])+
([Accounts].[All Levels].[Level 1].&[Expenses],[Measures].[Amount])
)
FROM
My Cube
;
并得到错误:"Parser: The statement dialect could not be resolved due to ambiguity."
试试这个:
WITH MEMBER [Measures].[Gross Profit] as
(
([Accounts].[All Levels].[Level 1].&[Gross Profit].&[Dept1],[Measures].[Amount])+
([Accounts].[All Levels].[Level 1].&[Gross Profit].&[Dept2],[Measures].[Amount])
)
/
(
([Accounts].[All Levels].[Level 1].&[Labor],[Measures].[Amount])+
([Accounts].[All Levels].[Level 1].&[Expenses],[Measures].[Amount])
)
SELECT [Measures].[Gross Profit] on COLUMNS
FROM
My Cube
;
我不知道如何将此 SSAS 计算表达式转换为 MDX 查询,以便我可以评估计算的各个部分。请帮忙!
计算应用于维度为:年、月、商店、部门和帐户的多维数据集。它还有 1 个名为 Amount 的度量。
计算表达式如下:
(
([Accounts].[All Levels].[Level 1].&[Gross Profit].&[Dept1],[Measures].[Amount])+
([Accounts].[All Levels].[Level 1].&[Gross Profit].&[Dept2],[Measures].[Amount])
)
/
(
([Accounts].[All Levels].[Level 1].&[Labor],[Measures].[Amount])+
([Accounts].[All Levels].[Level 1].&[Expenses],[Measures].[Amount])
)
它基本上只是尝试仅获取部门 1 和 2 的毛利润,然后将其除以人工和费用(所有部门)的总和。
这将针对年、月和商店 selected(或总共)完成。
现在,我想要做的是查看立方体中不同维度所看到的最终结果的组成部分,以便我可以验证计算结果。
例如,如果我 select 年:2018 年,月:1 月:商店:L001。假设结果金额为 40%。
我想看看毛利润(部门 1 和部门 2)的金额与人工和费用的金额是多少。表示实际基础金额,但详细
我试过只放入计算表达式:
select
(
([Accounts].[All Levels].[Level 1].&[Gross Profit].&[Dept1],[Measures].[Amount])+
([Accounts].[All Levels].[Level 1].&[Gross Profit].&[Dept2],[Measures].[Amount])
)
/
(
([Accounts].[All Levels].[Level 1].&[Labor],[Measures].[Amount])+
([Accounts].[All Levels].[Level 1].&[Expenses],[Measures].[Amount])
)
FROM
My Cube
;
并得到错误:"Parser: The statement dialect could not be resolved due to ambiguity."
试试这个:
WITH MEMBER [Measures].[Gross Profit] as
(
([Accounts].[All Levels].[Level 1].&[Gross Profit].&[Dept1],[Measures].[Amount])+
([Accounts].[All Levels].[Level 1].&[Gross Profit].&[Dept2],[Measures].[Amount])
)
/
(
([Accounts].[All Levels].[Level 1].&[Labor],[Measures].[Amount])+
([Accounts].[All Levels].[Level 1].&[Expenses],[Measures].[Amount])
)
SELECT [Measures].[Gross Profit] on COLUMNS
FROM
My Cube
;