MDX参数传递

0
各位老师,请问在MDX中时间参数如何传递?为神马老是提示问题呢
 
1、不带参数,代码运行成功:
WITH
    MEMBER [Measures].[Amount_D] AS
           [Measures].[Amount]  --当日销量
    MEMBER [Measures].[Amount_M] AS
           SUM(MTD([Dim Date].[Y-M-D].[Date Key].&[2015-10-21T00:00:00]),[Measures].[Amount])  --本月累计销量
SELECT
NON EMPTY
{ [Measures].[Amount_D], [Measures].[Amount_M] } ON 0,
NON EMPTY
{ ([Dim Department].[Department].[Department].ALLMEMBERS * [Dim City].[City].[City].ALLMEMBERS ) }  ON 1
FROM [CE Sales DW]
where [Dim Date].[Y-M-D].[Date Key].&[2015-10-21T00:00:00]
 
运行结果:

QQ截图20151218175248.png

 
2、将时间维度改为参数,代码运行失败(加粗的地方为改动):
WITH
    MEMBER [Measures].[Amount_D] AS
           [Measures].[Amount]  --当日销量
    MEMBER [Measures].[Amount_M] AS
           SUM(MTD(StrToMember("[Dim Date].[Y-M-D].[Date Key].&[" + Format(cdate(@key),"YYYY-MM-DD") + "T00:00:00]")),[Measures].[Amount])  --本月累计销量
SELECT
NON EMPTY
{ [Measures].[Amount_D], [Measures].[Amount_M] } ON 0,
NON EMPTY
{ ([Dim Department].[Department].[Department].ALLMEMBERS * [Dim City].[City].[City].ALLMEMBERS ) }  ON 1
FROM [CE Sales DW]
where StrToMember("[Dim Date].[Y-M-D].[Date Key].&[" + Format(cdate(@key),"YYYY-MM-DD") + "T00:00:00]")
 
 
运行提示:
1.png

参数key的设置:
2.png

 
请问各位老师,是Format函数的使用有问题吗?
已邀请:
0

天桥下的郑成功 - Hadoop大数据开发工程师、数仓架构师、熟悉数据仓库设计、Hadoop、Spark、HBase、Hive、SSIS等开发 2015-12-21 回答

SSMS不支持这样操作, 可以使用SSRS 进行参数传递的测试
0

ChrisPo 2015-12-21 回答

实际SSRS中的参数设置如下,请各位老师帮忙看下日历控件中的日期参数如何传递过来,计算当月的销量,谢谢
a3.png


a1.png


a2.png

 

a4.png

 

要回复问题请先登录注册