创建一个度量 return 关于事实 table 中订单的最大日期。 (SSAS 多维)
Create a measure to return the maximum date about the order in a fact table. (SSAS Multidimensional)
我想创建一个度量,其中 return 关于订单的最大日期但在实际日期之前
我会写一个例子:
My tables here
(在我的 table 日历中我有 2016、2017、2019 年,在我的订单 table 中,我有 2016 年和 2019 年的订单,
我想要最后一个日期订单,但在实际日期 (18/05/2017) 之前,所以我想要日期 01/01/2016)。
我有 2 个 table,一个维度日历和一个事实 table 订单。
我在想filter的功能,所以我搜索了filter的使用方法
google,我找到的所有解决方案都使用 'With' 和 'Select'。
(当我在 SSAS 多维中创建度量时,我不能使用 'With' 和 'Select')。
希望我能看到你的建议。
就像adv cube中的类似案例?
[max order date] return 关于[Internet Sales Amount]的最大日期
with member [max order date] AS
tail(NONEMPTY([Date].[Date].[Date],[Measures].[Internet Sales Amount])).item(0).item(0).PROPERTIES( "name" )
select {[max order date] } on 0 from [Adventure Works]
如果是,那么您可以像这样在多维数据集中创建一个度量:
Create Member CurrentCube.[Measures].[max order date]
As tail(NONEMPTY([Date].[Date].[Date],[Measures].[Internet Sales
Amount])).item(0).item(0).PROPERTIES( "name" );
如果只到今天,那么(以下是指 adv 多维数据集,您需要为每个多维数据集做一些代码更改):
Create Member CurrentCube.[max order date] AS
Tail
(
NonEmpty
(
{
Head([Date].[Date].[Date]).Item(0).Item(0)--the first day in your Date dim
:
StrToMember("[Date].[Date].&[" + Format(Now(),"yyyyMMdd") + "]")-- as of current day
}
,[Measures].[Internet Sales Amount]
)
).Item(0).Item(0).Properties("name")
IDE 高效地编写、分析、调整、调试 MDX (www.mdx-helper.com)
我想创建一个度量,其中 return 关于订单的最大日期但在实际日期之前
我会写一个例子:
My tables here
(在我的 table 日历中我有 2016、2017、2019 年,在我的订单 table 中,我有 2016 年和 2019 年的订单, 我想要最后一个日期订单,但在实际日期 (18/05/2017) 之前,所以我想要日期 01/01/2016)。
我有 2 个 table,一个维度日历和一个事实 table 订单。
我在想filter的功能,所以我搜索了filter的使用方法 google,我找到的所有解决方案都使用 'With' 和 'Select'。 (当我在 SSAS 多维中创建度量时,我不能使用 'With' 和 'Select')。
希望我能看到你的建议。
就像adv cube中的类似案例?
[max order date] return 关于[Internet Sales Amount]的最大日期
with member [max order date] AS
tail(NONEMPTY([Date].[Date].[Date],[Measures].[Internet Sales Amount])).item(0).item(0).PROPERTIES( "name" )
select {[max order date] } on 0 from [Adventure Works]
如果是,那么您可以像这样在多维数据集中创建一个度量:
Create Member CurrentCube.[Measures].[max order date]
As tail(NONEMPTY([Date].[Date].[Date],[Measures].[Internet Sales
Amount])).item(0).item(0).PROPERTIES( "name" );
如果只到今天,那么(以下是指 adv 多维数据集,您需要为每个多维数据集做一些代码更改):
Create Member CurrentCube.[max order date] AS
Tail
(
NonEmpty
(
{
Head([Date].[Date].[Date]).Item(0).Item(0)--the first day in your Date dim
:
StrToMember("[Date].[Date].&[" + Format(Now(),"yyyyMMdd") + "]")-- as of current day
}
,[Measures].[Internet Sales Amount]
)
).Item(0).Item(0).Properties("name")
IDE 高效地编写、分析、调整、调试 MDX (www.mdx-helper.com)