我想创建一个度量值,该度量值返回有关订单但在实际日期之前的最大日期
我会写一个例子:
我的桌子在这里
(在我的日历表中,我有 2016、2017、2019 年,在我的订单表中,我有 2016 年和 2019 年的订单,我想要最后日期订单,但在实际日期(18/05/2017(之前,所以我想要日期 01/01/2016(。
我有 2 个表,一个维度日历和一个事实表订单。
我在考虑函数过滤器,所以我搜索如何使用过滤器谷歌,以及我找到的所有解决方案都使用"With"和"Select"。(在 SSAS 多维中创建度量值时,我无法使用"With"和"Select"(。
希望我能看到你的建议。
就像 adv cube 中的类似情况一样?
[最大订单日期] 返回关于 [互联网销售额] 的最晚日期
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")
用于高效编写、分析、调整和调试 MDX 的 IDE (www.mdx-helper.com(