使用过滤器限制日期范围
Limiting date range using Filter
如何在不使用冒号运算符的情况下将集合 AllDates
过滤为 05Jan2005 到 10Jan2006?
WITH
SET [AllDates] AS
[Date].[Date].[Date].MEMBERS
MEMBER [Measures].[DTkey] AS
[Date].[Date].CurrentMember.Member_Key
MEMBER [Measures].[DTmemValue] AS
[Date].[Date].CurrentMember.MemberValue
MEMBER [Measures].[DTvalue] AS
[Date].[Date].CurrentMember.Value
SELECT
{[Measures].[DTmemValue]} ON 0
,Filter
(
[AllDates]
,
[Measures].[DTmemValue] > 0
) ON 1
FROM [Adventure Works];
WITH
SET [AllDates] AS
[Date].[Date].[Date].MEMBERS
MEMBER [Measures].[DTkey] AS
[Date].[Date].CurrentMember.Member_Key
MEMBER [Measures].[DTmemValue] AS
[Date].[Date].CurrentMember.MemberValue
MEMBER [Measures].[DTvalue] AS
[Date].[Date].CurrentMember.Value
SELECT
{[Measures].[DTmemValue]} ON 0
,Filter
(
[AllDates]
,
CDate([Measures].[DTmemValue]) > CDate("2006-01-01")
) ON 1
FROM [Adventure Works];
可以找到有关 MDX 过滤的更多详细信息:http://chrish.com.au/blog/filtering-in-mdx/
我没有 Adv Wks,但在我的设备上测试了以下内容,效果很好。
这是您要找的吗?
WITH
SET [AllDates] AS
[Date].[date].[date].members
MEMBER [Measures].[DTkey] AS
[Date].[date].CurrentMember.Member_Key
MEMBER [Measures].[DTmemValue] AS
[Date].[date].CurrentMember.MemberValue
MEMBER [Measures].[DTvalue] AS
[Date].[date].CurrentMember.Value
SELECT
{[Measures].[DTmemValue]} ON 0
,Filter
(
[AllDates]
,
CDate([Measures].[DTmemValue]) >= CDate("01/05/2005")
and CDate([Measures].[DTmemValue]) <= CDate("01/10/2006")
) ON 1
FROM [Adventure Works];
如何在不使用冒号运算符的情况下将集合 AllDates
过滤为 05Jan2005 到 10Jan2006?
WITH
SET [AllDates] AS
[Date].[Date].[Date].MEMBERS
MEMBER [Measures].[DTkey] AS
[Date].[Date].CurrentMember.Member_Key
MEMBER [Measures].[DTmemValue] AS
[Date].[Date].CurrentMember.MemberValue
MEMBER [Measures].[DTvalue] AS
[Date].[Date].CurrentMember.Value
SELECT
{[Measures].[DTmemValue]} ON 0
,Filter
(
[AllDates]
,
[Measures].[DTmemValue] > 0
) ON 1
FROM [Adventure Works];
WITH
SET [AllDates] AS
[Date].[Date].[Date].MEMBERS
MEMBER [Measures].[DTkey] AS
[Date].[Date].CurrentMember.Member_Key
MEMBER [Measures].[DTmemValue] AS
[Date].[Date].CurrentMember.MemberValue
MEMBER [Measures].[DTvalue] AS
[Date].[Date].CurrentMember.Value
SELECT
{[Measures].[DTmemValue]} ON 0
,Filter
(
[AllDates]
,
CDate([Measures].[DTmemValue]) > CDate("2006-01-01")
) ON 1
FROM [Adventure Works];
可以找到有关 MDX 过滤的更多详细信息:http://chrish.com.au/blog/filtering-in-mdx/
我没有 Adv Wks,但在我的设备上测试了以下内容,效果很好。
这是您要找的吗?
WITH
SET [AllDates] AS
[Date].[date].[date].members
MEMBER [Measures].[DTkey] AS
[Date].[date].CurrentMember.Member_Key
MEMBER [Measures].[DTmemValue] AS
[Date].[date].CurrentMember.MemberValue
MEMBER [Measures].[DTvalue] AS
[Date].[date].CurrentMember.Value
SELECT
{[Measures].[DTmemValue]} ON 0
,Filter
(
[AllDates]
,
CDate([Measures].[DTmemValue]) >= CDate("01/05/2005")
and CDate([Measures].[DTmemValue]) <= CDate("01/10/2006")
) ON 1
FROM [Adventure Works];