问题
This is our current MTD calculation:
MEMBER [Time Calculations].[Time Calculations].[Calculate MTD] AS
Sum
(
MTD([Date].[Date - Calendar Month].CurrentMember)
,[Time Calculations].[Time Calculations].[Current Value]
)
I've seen somewhere along the way a MTD calculation that uses the range operator :. The following will be a sum from the start of time:
MEMBER [Time Calculations].[Time Calculations].[Calculate MTD] AS
Sum
(
null: [Date].[Date - Calendar Month].CurrentMember
,[Time Calculations].[Time Calculations].[Current Value]
)
Can anyone remember how to adjust the above so that it is a MTD calculation?
回答1:
If [Date - Calendar Month] is similar to Calendar hierarchy of Adventure Works, following might work for you:
MEMBER [Time Calculations].[Time Calculations].[Calculate MTD] AS
Sum
(
[Date].[Date - Calendar Month].CurrentMember.firstsibling
:
[Date].[Date - Calendar Month].CurrentMember
,[Time Calculations].[Time Calculations].[Current Value]
)
来源:https://stackoverflow.com/questions/32441887/mtd-without-using-the-mtd-function