MDX 结果中的总数错误
Wrong totals in MDX result
我有以下 MDX 查询:
SELECT { [Measures].[Work Order Count Housekeeping Per Sq Ft],
[Measures].[Work Order Count],
[Measures].[House Keeping Square Footage]} ON 0,
{ ( [Location].[Entity Location Name].Members ) } ON 1
FROM [Work Order]
WHERE ( { [Department].[Department Name].[Housekeeping]},
{ [Location].[Entity Location ID].[12280], [Location].[Entity Location ID].[14067], [Location].[Entity Location ID].[15092]},
{ [Event Start Dates].[Date Key].[20160705] : [Event Start Dates].[Date Key].[20180705] },
{ [Owner Entity].[Entity ID].[12279], [Owner Entity].[Entity ID].[12280], [Owner Entity].[Entity ID].[14067], [Owner Entity].[Entity ID].[15092]},
{ [Work Order Days Open].[Days Open].[1] : [Work Order Days Open].[Days Open].[250] },
{ [Work Order Days Overdue].[Days Overdue].[1] : [Work Order Days Overdue].[Days Overdue].[250] } )
这是我得到的结果:
我期望(*并且需要)All 值是 6.42857、45 和 7,而不是我得到的值。
我在查询中做错了什么?
ALL 永远是 ALL
您似乎想要一个新的 ALL,它是 WHERE 子句中选择的 3 个成员的集合。
您可以使用 WITH 子句创建 ALLcustom 成员:
WITH
SET LocationSet AS
{ [Location].[Entity Location ID].[12280],
[Location].[Entity Location ID].[14067],
[Location].[Entity Location ID].[15092]}
MEMBER Location].[Entity Location ID].[All].ALLcustom AS
AGGREGATE ( LocationSet )
SET [Locations] AS
{LocationSet,
[Location].[Entity Location ID].[All].ALLcustom
}
SELECT { [Measures].[Work Order Count Housekeeping Per Sq Ft],
[Measures].[Work Order Count],
[Measures].[House Keeping Square Footage]} ON 0,
[Locations] ON 1
FROM [Work Order]
WHERE ( { [Department].[Department Name].[Housekeeping]},
{ [Event Start Dates].[Date Key].[20160705] : [Event Start Dates].[Date Key].[20180705] },
{ [Owner Entity].[Entity ID].[12279], [Owner Entity].[Entity ID].[12280], [Owner Entity].[Entity ID].[14067], [Owner Entity].[Entity ID].[15092]},
{ [Work Order Days Open].[Days Open].[1] : [Work Order Days Open].[Days Open].[250] },
{ [Work Order Days Overdue].[Days Overdue].[1] : [Work Order Days Overdue].[Days Overdue].[250] } )
我有以下 MDX 查询:
SELECT { [Measures].[Work Order Count Housekeeping Per Sq Ft],
[Measures].[Work Order Count],
[Measures].[House Keeping Square Footage]} ON 0,
{ ( [Location].[Entity Location Name].Members ) } ON 1
FROM [Work Order]
WHERE ( { [Department].[Department Name].[Housekeeping]},
{ [Location].[Entity Location ID].[12280], [Location].[Entity Location ID].[14067], [Location].[Entity Location ID].[15092]},
{ [Event Start Dates].[Date Key].[20160705] : [Event Start Dates].[Date Key].[20180705] },
{ [Owner Entity].[Entity ID].[12279], [Owner Entity].[Entity ID].[12280], [Owner Entity].[Entity ID].[14067], [Owner Entity].[Entity ID].[15092]},
{ [Work Order Days Open].[Days Open].[1] : [Work Order Days Open].[Days Open].[250] },
{ [Work Order Days Overdue].[Days Overdue].[1] : [Work Order Days Overdue].[Days Overdue].[250] } )
这是我得到的结果:
我期望(*并且需要)All 值是 6.42857、45 和 7,而不是我得到的值。
我在查询中做错了什么?
ALL 永远是 ALL
您似乎想要一个新的 ALL,它是 WHERE 子句中选择的 3 个成员的集合。
您可以使用 WITH 子句创建 ALLcustom 成员:
WITH
SET LocationSet AS
{ [Location].[Entity Location ID].[12280],
[Location].[Entity Location ID].[14067],
[Location].[Entity Location ID].[15092]}
MEMBER Location].[Entity Location ID].[All].ALLcustom AS
AGGREGATE ( LocationSet )
SET [Locations] AS
{LocationSet,
[Location].[Entity Location ID].[All].ALLcustom
}
SELECT { [Measures].[Work Order Count Housekeeping Per Sq Ft],
[Measures].[Work Order Count],
[Measures].[House Keeping Square Footage]} ON 0,
[Locations] ON 1
FROM [Work Order]
WHERE ( { [Department].[Department Name].[Housekeeping]},
{ [Event Start Dates].[Date Key].[20160705] : [Event Start Dates].[Date Key].[20180705] },
{ [Owner Entity].[Entity ID].[12279], [Owner Entity].[Entity ID].[12280], [Owner Entity].[Entity ID].[14067], [Owner Entity].[Entity ID].[15092]},
{ [Work Order Days Open].[Days Open].[1] : [Work Order Days Open].[Days Open].[250] },
{ [Work Order Days Overdue].[Days Overdue].[1] : [Work Order Days Overdue].[Days Overdue].[250] } )