Query (2, 2) By default, a year level was expected. No such level was found in the cube.ytd Function In MDX Query Not Work

StackOverflow https://stackoverflow.com/questions/18418380

Question

I use SSAS and SQL Server 2008 R2 and AdventureWorks Database.

I write this query :

Select
ytd([Date].[Calendar].[Calendar Quarter].[Q3 CY 2003]) on columns
From [Adventure Works]

and i get this result :

enter image description here

but when i execute this query :

Select
ytd([Date].[Fiscal].[Fiscal Quarter].[Q3 FY 2003]) on columns
From [Adventure Works]

i get this error :

Executing the query ...
Query (2, 2) By default, a year level was expected. No such level was found in the cube.

Execution complete

why this query not work ?

Was it helpful?

Solution

From the documentation : The Ytd function is a shortcut function for the PeriodsToDate [...] .Note that this function will not work when the Type property is set to FiscalYears. How about using the following instead :

Select

  PeriodsToDate(
    [Date].[Fiscal].[Fiscal Year],
    [Date].[Fiscal].[Fiscal Quarter].[Q3 FY 2003]
  ) on columns

From [Adventure Works]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top