SSAS MDX datepart iso_week

时间:2016-03-08 13:49:36

标签: ssas mdx week-number datepart

在T-SQL中,我可以使用dateprat函数检索ISO周号:

 select datepart(iso_week, sysdatetime())

MDX中是否有等价物?我有麻烦找到它。 我可以在MDX中检索周数,例如像这样:

with member Measures.Test as (Format(now(), "yyyy") + cstr(datepart("ww", now())))
select  Measures.Test on columns
from    MyCube

但是iso_week怎么样? 谢谢, 彼得

2 个答案:

答案 0 :(得分:0)

参考评论

  

我需要为报告编写MDX查询,其中包含当前ISO周的所有周数

您可以尝试以下方法:

with member 
Measures.CurrentWeek as cstr(datepart("ww", now()))

member 
WeekValue AS [Date].[Week].CURRENTMEMBER.MEMBER_VALUE

select  
Measures.dummymeasures 
ON 0,
[Date].[Week].[Week].MEMBERS HAVING WeekValue <= Measures.CurrentWeek 
ON 1
FROM [YourCube]
WHERE ([Date].[Year].&[2016])

答案 1 :(得分:0)

请尝试以下:

WITH
MEMBER [Measures].[Iso_week] AS Datepart("ww",NOW()-WeekDay(NOW(),2)+4,2,2)
SELECT [Measures].[Iso_week] ON 0
FROM [Some_cube]

此处提供更多帮助:http://www.snb-vba.eu/VBA_ISO_weeknummer_en.html