mdx mtd error please help
-
Saturday, February 02, 2013 7:08 PM
I am getting the following error when trying to calculate the MTD function
By default, a month level was expected. No such level was found in the cube.
FORMATTED_VALUE #Error Query (7, 1) By default, a month level was expected. No such level was found in the cube.I am trying to get the total of the month of april for the year 1995. Here is the code.
MEMBER [Measures]. [hh] as mtd([Dim_DateTime].[Calender].[MonthofYear].&[1995]&[4]) Select {[Measures].[Value Actual],[Measures]. [hh]} on columns from cubeThanks for your help
-Sarah
All Replies
-
Sunday, February 03, 2013 9:12 AM
Hi Sarah ,
If you'll brose the cube and open your Date Dim, would it look like the below ? with month level appers in your hierarchy ..
Plese try the next code :
with MEMBER [Measures]. [hh] as AGGREGATE( {mtd([Dim_DateTime].[Calender].[MonthofYear].&[1995]&[4])} ,[Measures].[Actual Value]) ,FORMAT_STRING = "###,###" Select {[Measures]. [hh]} on columns from CubeRegards, David .
-
Monday, February 04, 2013 4:35 AM
Sarah, mtd() will only work if you have a level on your [Dim_DateTime] marked as Month.
mtd() is really just a shorthand for PeriodsToDate, so you could also do something like
AGGREGATE(periodstodate([Dim_DateTime].[Calender].[MonthofYear], [Dim_DateTime].[Calender].[MonthofYear].&[1995]&[4])
,[Measures].[Actual Value])
http://RichardLees.blogspot.com
Richard
- Proposed As Answer by RichardLees Monday, February 04, 2013 4:35 AM
- Marked As Answer by Elvis LongMicrosoft Contingent Staff, Moderator Tuesday, February 12, 2013 3:21 PM

