在MDX查询中获取当前日期

时间:2017-10-10 10:39:36

标签: mdx

我正在尝试获取当前日期记录,并且我有一个查询,其中给出了特定日期,如何将currentdate放在该位置。

我是MDX的新手,如果有人回答这将非常有帮助。

以下是MDX查询:

SELECT NON EMPTY { [Measures].[SHC] } ON COLUMNS, NON EMPTY { ([C].[RHC].[rhc].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( { [DHC].[DHC].&[01/01/1992] } ) ON COLUMNS FROM [TABULAR_EAL]) WHERE ( [DHC].[DHC].&[01/01/1992] ) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

我想根据CurrentDate获取记录。

2 个答案:

答案 0 :(得分:1)

这样的事情:

StrToMember('[DHC].[DHC].&[' + Format(Now(),'dd/MM/yyyy') + ']')

有关详细信息,请参阅我的blogpost

答案 1 :(得分:0)

我完成了答案:

With Member Measures.CurrentDate As 
Format(
    Now(),
    'yyyyMMdd'
)

Member Measures.GetMemberCurrentDate as
'[Start Date].[Miladi Int Date].&['+ measures.CurrentDate + ']'

member Measures.GetCurrentDateBimehValue as
(StrToMember(Measures.GetMemberCurrentDate) ,[Measures].[BimehValue])


select Measures.GetCurrentDateBimehValue on columns
from [BimehCube]