我想计算用户提供的月数average Delivered YTD qty
。我如何获得会计月份编号。我尝试引入一个新属性财务月份编号,但它返回值"所有期间"因此在我的计算中变得毫无用处。不知道如何获得月份数字。我想避免硬编码数据:)
WITH
MEMBER [Selected Fiscal Year] AS
[Date].[Fiscal Year].CurrentMember.Properties("MEMBER_KEY")
MEMBER [Selected Fiscal Month] AS
[Date].[Fiscal Month].CurrentMember.Properties("MEMBER_Value")
MEMBER [FM NUMBER] AS
[Date].[Fiscal Month Number].CurrentMember.Properties("MEMBER_Value")
SELECT
{
[Measures].[Delivered Qty]
,[Measures].[Delivered YTD QTY]
,Measures.[Selected Fiscal Month]
,Measures.[FM NUMBER]
} ON COLUMNS
,{
[Date].[Fiscal Month].&[Selected Fiscal Year]&[1]
:
[Date].[Fiscal Month].&[2015]&[12]
} ON ROWS
FROM [My Warehouse]
WHERE
[Date].[Fiscal Year].&[2015];
答案 0 :(得分:0)
您可以从MEMBER_KEY
属性中获取所需内容:
WITH
MEMBER [Measures].[k] AS
[Date].[Calendar].CurrentMember.Member_Key
MEMBER [Measures].[yearNum] AS
Fix([Measures].[k] / 10000)
MEMBER [Measures].[monthNum] AS
Fix(([Measures].[k] - Fix([Measures].[k] / 10000) * 10000) / 100)
MEMBER [Measures].[dayNum] AS
Fix([Measures].[k] - Fix([Measures].[k] / 100) * 100)
MEMBER [Measures].[backTogetherAsDate!!] AS
Dateserial
(
[Measures].[yearNum]
,[Measures].[monthNum]
,[Measures].[dayNum]
)
,format_string = 'dd mmm yyyy'
SELECT
{
[Measures].[k]
,[Measures].[yearNum]
,[Measures].[monthNum]
,[Measures].[dayNum]
,[Measures].[backTogetherAsDate!!]
} ON 0
,Tail([Date].[Calendar].[Date]) ON 1
FROM [Adventure Works];
结果如下: