查询(2,2)默认情况下,预期为年级.在cube.ytd函数中找不到这样的级别在MDX查询中不起作用

Ard*_*oli 2 olap ssas mdx sql-server-2008-r2

我使用SSAS和SQL Server 2008 R2和AdventureWorks数据库.

我写这个查询:

Select
ytd([Date].[Calendar].[Calendar Quarter].[Q3 CY 2003]) on columns
From [Adventure Works]
Run Code Online (Sandbox Code Playgroud)

我得到这个结果:

在此输入图像描述

但是当我执行这个查询时:

Select
ytd([Date].[Fiscal].[Fiscal Quarter].[Q3 FY 2003]) on columns
From [Adventure Works]
Run Code Online (Sandbox Code Playgroud)

我收到此错误:

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

Execution complete
Run Code Online (Sandbox Code Playgroud)

为什么这个查询不起作用?

Mar*_*zzi 5

文档中:Ytd函数是PeriodsToDate [...]的快捷函数.注意当Type属性设置为FiscalYears时,此函数将不起作用.如何使用以下代码:

Select

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

From [Adventure Works]
Run Code Online (Sandbox Code Playgroud)