首页新闻找找看学习计划

mdx 查询当天的数据

0
[已关闭问题] 关闭于 2017-03-15 17:28

原始 MDX 语句 

SELECT { [Measures].[Seat Use Count]* [Dim Date].[Date Name].[Date Name].ALLMEMBERS }
ON COLUMNS, { ([BG Info].[BG Name].[BG Name].ALLMEMBERS ) }
ON ROWS FROM ( SELECT ( [Dim Date].[Date Name].&[2016-07-13T00:00:00] :
[Dim Date].[Date Name].&[2016-07-14T00:00:00] )
ON COLUMNS FROM [Office Space])

 

希望把2016-07-13T00:00:00 换成动态的 获取 昨天,2016-07-14T00:00:00动态获取今天。

pengbg的主页 pengbg | 初学一级 | 园豆:13
提问于:2016-07-15 17:32
< >
分享
所有回答(1)
0

使用 StrToMember  函数。

eg:

WITH MEMBER MEASURES.BGUseCount AS IIF([Measures].[Seat Use Count]>0,[Measures].[Seat Use Count], 0)
MEMBER MEASURES.BGODCUseCount AS IIF((MEASURES.BGUseCount,[Staff Type].[Staff Type Other Name].&[外包])>0,(MEASURES.BGUseCount,[Staff Type].[Staff Type Other Name].&[外包]),0)
MEMBER MEASURES.BGFormalUseCount AS IIF((MEASURES.BGUseCount,[Staff Type].[Staff Type Other Name].&[正式])>0,(MEASURES.BGUseCount,[Staff Type].[Staff Type Other Name].&[正式]),0)
SELECT {
MEASURES.BGUseCount,MEASURES.BGODCUseCount, MEASURES.BGFormalUseCount
}
ON COLUMNS,
{ ([Staff Dept].[BG Name].[BG Name].ALLMEMBERS *[Staff Dept].[Dept Name].[Dept Name].ALLMEMBERS ) }
ON ROWS
FROM (
SELECT ( { StrToMember("[Dim Date].[Date Name].&["+ Format( DateAdd ('d',-1,now()),"yyyy-MM-ddT00:00:00") +"]") } ) ON COLUMNS FROM [Office Space]) WHERE
( StrToMember("[Dim Date].[Date Name].&["+ Format( DateAdd ('d',-1,now()),"yyyy-MM-ddT00:00:00") +"]") )

 

pengbg | 园豆:13 (初学一级) | 2016-07-26 16:18
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册