尺寸类型在SSAS中起什么作用?

时间:2018-11-23 17:34:38

标签: ssas mdx

我对SSAS表格具有更丰富的经验,但是在工作中,我必须支持SSAS多维多维数据集。今天早些时候,我尝试向Excel数据透视表中的SSASMD连接添加时间智能计算(并行周期)。但是无论我使用哪种语法,评估结果都会出错。

在解决错误之后,我在SQL Server Central(Stairway to MDX - Level 13: MDX Time/Date Series Functions: LastPeriods() and ParallelPeriod() Functions)上遇到了这篇文章。

我的问题:DATE维度是否必须具有类型“ TIME”才能使日期函数起作用?这是我的YOY计算的语法。

已售出的磅数实际值-v1

(
[DATES].[INVOICE_DATE].[INVOICE_DATE].CurrentMember.PrevMember
,[Measures].[Lbs Sold]
)

已售出的磅数实际值-v2

(ParallelPeriod(
    [INVOICE_DATE].[DATES].CurrentMember.Level,
    1,
    [INVOICE_DATE].[DATES].CurrentMember
    ),
    [Measures].[Lbs Sold])

我对DAX的经验比对MDX的经验丰富,因此任何见解将不胜感激。  我的MDX计算源...


维度类型

我也很好奇,其他 Dimension Types 都有什么用?将其从“正常”更改为其他任何功能是否会使多维数据集具有其他功能?我在网上找到了一些说明(粘贴在下面),但是我很好奇这实际上是做什么的?

来自Microsoft文档...

  

“类型”属性设置提供有关内容的信息   服务器和客户端应用程序的维度。在某些情况下,类型   设置仅为客户端应用程序提供指导,并且   可选的。在其他情况下,例如“帐户”或“时间”维度,   维度的类型属性设置及其属性确定   基于服务器的特定行为,可能需要实施   多维数据集中的某些行为。例如,   维度可以设置为“帐户”以指示客户应用程序   标准维度包含帐户属性。

+-----------------+---------------------------------------------------------------------------+
| Type            | Description                                                               |
+-----------------+---------------------------------------------------------------------------+
| Regular         | Default for dimensions that are not set to a specified type               |
+-----------------+---------------------------------------------------------------------------+
| Time            | Used for dimensions whose attributes represent time periods               |
+-----------------+---------------------------------------------------------------------------+
| Geography       | Used for dimensions whose attributes represent geographical inform-ation  |
+-----------------+---------------------------------------------------------------------------+
| Organization    | Used for dimensions whose attributes represent organizational information |
+-----------------+---------------------------------------------------------------------------+
| BillOfMaterials | Used for dimensions whose attributes represent inventory and              |
|                 |   man-ufacturing information                                              |
+-----------------+---------------------------------------------------------------------------+
| Accounts        | Used for dimensions whose attributes represent information used for       |
|                 |   financial reporting                                                     |
+-----------------+---------------------------------------------------------------------------+
| Customers       | Used for dimensions whose attributes represent information about          |
|                 |   customers                                                               |
+-----------------+---------------------------------------------------------------------------+
| Products        | Used for dimensions whose attributes represent information about products |
+-----------------+---------------------------------------------------------------------------+
| Scenario        | Used for dimensions whose attributes represent information about plans    |
|                 |   and strategies                                                          |
+-----------------+---------------------------------------------------------------------------+
| Quantitative    | Used for dimensions whose attributes represent quantitative inform-ation  |
+-----------------+---------------------------------------------------------------------------+
| Utility         | Used for dimensions whose attributes represent utility information        |
+-----------------+---------------------------------------------------------------------------+
| Currency        | Used for dimensions whose attributes represent currency inform-ation      |
+-----------------+---------------------------------------------------------------------------+
| Rates           | Used for dimensions whose attributes represent currency rate inform-ation |
+-----------------+---------------------------------------------------------------------------+
| Channel         | Used for dimensions whose attributes represent channel information        |
+-----------------+---------------------------------------------------------------------------+
| Promotion       | Used for dimensions whose attributes represent marketing pro-motion       |
|                 |   information                                                             |
+-----------------+---------------------------------------------------------------------------+

1 个答案:

答案 0 :(得分:1)

您可以自己尝试一下。让我们选择Para​​llelPeriod函数:

select 
    ParallelPeriod(
        [Customer].[Customer Geography].[Country],  
        3,
        [Customer].[Customer Geography].[State-Province].[Hamburg]
    ) on 0  
from [Adventure Works]  

返回南澳大利亚。这没有任何意义,但是可以。因此,您的问题的答案是“ DATE维度是否必须具有类型'TIME'才能使日期函数起作用?”不是。

根据我的经验,更改维类型的唯一原因是,当您使用半累加聚合函数(即LastNonEmpty)时,它需要多维数据集内的时间维,以便确定该期间所有间隔的值集

除此之外,它只是客户端信息。客户可以使用不同类型的图标来适应其他情况。