Ssas MDX-获取行上父组的最后一个值

Ssas MDX-获取行上父组的最后一个值,ssas,mdx,tail,Ssas,Mdx,Tail,我有一个数据集,可以输出每个季度的最后一部分(2015年第一季度、第二季度、第三季度、第四季度)。对于latest segment,我指的是segment属性的最后一个值,作为参数,从其各自季度的第一周到所选日期 下面的查询正在输出 2015年第一季度-C 2015年第二季度-/ 问题在于,从2015 W1到2015 W14,段始终为C。W14之后,段变为“/”。因此,在我看来,查询没有考虑YTD函数 SET [All calendars] AS [Date invoice].[Bo

我有一个数据集,可以输出每个季度的最后一部分(2015年第一季度、第二季度、第三季度、第四季度)。对于latest segment,我指的是segment属性的最后一个值,作为参数,从其各自季度的第一周到所选日期

下面的查询正在输出

  • 2015年第一季度-C
  • 2015年第二季度-/
问题在于,从2015 W1到2015 W14,段始终为C。W14之后,段变为“/”。因此,在我看来,查询没有考虑YTD函数

SET [All calendars] AS
    [Date invoice].[Bonus calendar - Quarter].[Bonus Quarter].ALLMEMBERS


SET [Stratum history] AS
    Generate(
        {[All calendars]} AS s
        ,s.Current
            *HEAD(
                NonEmpty
                (
                 [Stratum history].[Stratum].[Stratum]
                ,[Stratum sales average]
                )
            ,1
            )
    )
where条款:

WHERE
//Only calculate for the current bonus year until the current week
StrToMember("[Date invoice].[Bonus year].&[" + CStr(StrToMember(@PAR_Date).Parent.MemberValue) + "]")
*Ytd(StrToMember(@PAR_Date))
*StrToMember(@POS_ID)
如果我将所有日历设置更改为[日期发票].[奖金日历-夸脱].[季度奖金周].所有成员,则我将获得全套日历

2015 W1-C ... 2015 W14-C

然后查询在my where子句中指定的2015 W14处停止!但我只想在我的行上显示四分之一级别


有什么建议吗?

如何修改第二组的
非空
子句,如下所示:

SET [Stratum history] AS
    Generate(
        {[All calendars]} AS s
        ,s.Current
            *HEAD(
                NonEmpty
                (
                 [Stratum history].[Stratum].[Stratum].MEMBERS
                ,([Stratum sales average], s.Current)
                )
            ,1
            )
    )

将第二个集合的
NonEmpty
子句修改如下:

SET [Stratum history] AS
    Generate(
        {[All calendars]} AS s
        ,s.Current
            *HEAD(
                NonEmpty
                (
                 [Stratum history].[Stratum].[Stratum].MEMBERS
                ,([Stratum sales average], s.Current)
                )
            ,1
            )
    )

W1对应Q1,W14对应Q2,对吗?或者是怎样的?我觉得
WHERE
子句很好。你能给出
@PAR_Date
的任何样本值,并告诉我们你的
[奖金年]
层次结构是什么样子的吗?W1对应于Q1,W14对应于Q2,对吗?或者是怎样的?我觉得
WHERE
子句很好。你能给出
@PAR\u Date
的任何样本值,并告诉我们你的
[奖金年]
层级结构是什么样的吗?