select
Filter(
[
Product
]
.
[
Category
]
.Members,
[
Measures
]
.
[
Dollar Sales
]
>
900000
//and
[
Measures
]
.
[
Unit Sales
]
>
90000
)
on
axis(
0
)
from
Sales
Where
(
[
Time
]
.
[
2005
]
,
[
Measures
]
.
[
Dollar Sales
]
)
查询的结果是:
select
Filter(
[
Product
]
.
[
Category
]
.Members,
[
Measures
]
.
[
Dollar Sales
]
>
900000
and
[
Measures
]
.
[
Unit Sales
]
>
90000
)
on
axis(
0
)
from
Sales
Where
(
[
Time
]
.
[
2005
]
,
[
Measures
]
.
[
Dollar Sales
]
)
查询的结果是:
为什么Filter函数的加了and [Measures].[Unit Sales]>90000条件后,返回的列只有All呢,难道Filter函数只能用一个条件吗
select
Filter(
[
Product
]
.
[
Category
]
.Members,
[
Measures
]
.
[
Dollar Sales
]
>
1.4
*
(
[
Measures
]
.
[
Dollar Sales
]
,
[
Time
]
.
[
YQMD
]
.CurrentMember.PrevMember
)
)
on
axis(
0
)
from
Sales
Where
(
[
Time
].[YQMD]
.
[
2005
]
,
[
Measures
]
.
[
Dollar Sales
]
)
因为上下文的时间成员是[2005],则前一个时间成员应该是[2005], 即[Time].[YQMD].CurrentMember.PrevMember的成员是[2004]
因为上下文从每个维度中取出一个成员放入其中,所以在表达式中可以更多地依靠它进行查询。下面的查询与前面的查询结果一样,但却使用了不同的表达式,这是因为filter()函数中的上下文包含并使用了[measures].[Doolar Sales]
1.4*
([Measures].[Dollar Sales],
[Time].[YQMD].CurrentMember.PrevMember
)
改成了1.4*[Time].[YQMD].CurrentMember.PrevMember
select
Filter(
[
Product
]
.
[
Category
]
.Members,
[
Measures
]
.
[
Dollar Sales
]
>
1.4
*
[
Time
]
.
[
YQMD
]
.CurrentMember.PrevMember
)
on
axis(
0
)
from
Sales
Where
(
[
Time
].[YQMD]
.
[
2005
]
,
[
Measures
]
.
[
Dollar Sales
]
)