SSAS,我有三种货币的DAILY,MTD和YTD平均余额作为度量标准,当我按货币过滤或从组织中选择月或年级别时,我只想显示1个字段。预先谢谢你
答案 0 :(得分:0)
有多种创建多维数据集的方法。例如,您可以有一个度量金额,它是所有货币的总和,如果没有选择货币,该度量将不起作用。在这种情况下,您应该这样做:
SELECT
{ [Measures].[Amount] } ON COLUMNS,
{ [Date].currentMember,[Currency].currentMember } ON ROWS
FROM [ Cube ]
它应该工作。现在,这当然取决于多维数据集的创建方式,因此,如果需要更好的答案,可以提供更多详细信息。例如,如果您有3种度量(每种货币一种),则可以对它们进行求和并过滤结果,如下所示:
WITH MEMBER MEASURES.[Total Amount] AS
[Measures].[Amount USD] + [Measures].[Amount EUR] + [Measures].[Amount GBP]
SELECT
{ [Measures].[Total Amount] } ON COLUMNS,
{ [Date].currentMember,[Currency].currentMember } ON ROWS
FROM [ Cube ]
问题在于,如果您不选择货币,它仍然会给出总金额,因此您可能会得到类似以下的内容:
WITH MEMBER MEASURES.[Selected Currency Amount] AS
CASE
WHEN [Currency].currentMember is [Currency].&[EUR] THEN [Measures].[Amount EUR]
WHEN [Currency].currentMember is [Currency].&[GBP] THEN [Measures].[Amount GBP]
WHEN [Currency].currentMember is [Currency].&[USD] THEN [Measures].[Amount USD]
ELSE 0
END
SELECT
{ MEASURES.[Selected Currency Amount] } ON COLUMNS,
{ [Date].currentMember,[Currency].currentMember } ON ROWS
FROM [ Cube ]
这样,对于每种货币,“所选货币金额”将是正确的金额。如果您不选择货币(从行轴中删除货币),它将为0