我正在使用以下内容,但我认为可能有一种更简单的方法可以All从结果中排除成员?
WITH
SET [Non_All_Distributors] AS
{FILTER(
[Distributor Name].members,
(InStr(1, [Distributor Name].CurrentMember.NAME, "All") = 0)
)}
SET [Non_All_Countries] AS
{FILTER(
[Geography Country].members,
(InStr(1, [Geography Country].CurrentMember.NAME, "All") = 0)
)}
SELECT
NON EMPTY
[Dimension].[Hierarchy].DEFAULTMEMBER
ON COLUMNS,
NON EMPTY
[Non_All_Distributors]
*
[Non_All_Countries]
*
Tail([Date].[Date - Calendar Month].[Calendar Day].Members,60)
*
{
[Measures].[Revenue],
[Measures].[NumClients]
}
ON ROWS
FROM [OURCUBE]
Run Code Online (Sandbox Code Playgroud)
只需使用
SELECT
NON EMPTY
[Dimension].[Hierarchy].DEFAULTMEMBER
ON COLUMNS,
NON EMPTY
[dimension of Distributor Name].[Distributor Name].[Distributor Name].Members
*
[dimension of Geography Country].[Geography Country].[Geography Country].Members
*
Tail([Date].[Date - Calendar Month].[Calendar Day].Members,60)
*
{
[Measures].[Revenue],
[Measures].[NumClients]
}
ON ROWS
FROM [OURCUBE]
Run Code Online (Sandbox Code Playgroud)
这里不需要定义集合。您可以在行子句中直接说明经销商和国家/地区成员。
通过重复属性名称,您可以将属性层次结构限制在成员[dim].[attrib name]之下的级别All,而该级别恰好又与属性具有相同的名称。属性层次结构有两个级别:级别 0 包含“全部”成员,级别 1 包含属性的所有成员。(仅当您没有进行特殊配置(例如将属性设置为不可聚合)时,这才是正确的,但我假设标准情况,因为您All的层次结构中有成员。
除了更简单之外,这条语句的运行速度会更快,这Filter在许多情况下是一个真正的性能杀手。
| 归档时间: |
|
| 查看次数: |
2556 次 |
| 最近记录: |