3

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

我写了这个查询:

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

我得到了这个结果:

在此处输入图像描述

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

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

我收到此错误:

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

Execution complete

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

4

1 回答 1

6

来自文档: Ytd 函数是 PeriodsToDate [...] 的快捷函数。请注意,当 Type 属性设置为 FiscalYears 时,此函数将不起作用。如何改用以下内容:

Select

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

From [Adventure Works]
于 2013-08-25T00:30:20.847 回答