【问题标题】:What does the DIMENSION TYPE do in SSAS?SSAS 中的 DIMENSION TYPE 有什么作用?
【发布时间】:2018-11-23 17:34:37
【问题描述】:

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

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

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

Lbs Sold YOY Actuals-v1

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

Lbs Sold YOY Actuals-v2

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

我在 DAX 方面的经验比在 MDX 方面更有经验,因此我们将不胜感激。 我的 MDX 计算来源...


维度类型

我也很好奇,其他所有 Dimension Types 是用来做什么的?将其从“正常”更改为任何其他是否会赋予立方体额外的功能?我在网上找到了一些描述(粘贴在下面),但我很好奇这实际上是做什么的?

来自 Microsoft 文档...

Type 属性设置提供有关 服务器和客户端应用程序的维度。在某些情况下,类型 设置仅为客户端应用程序提供指导,并且是 选修的。在其他情况下,例如 Accounts 或 Time 维度, 维度的类型属性设置及其属性确定 特定的基于服务器的行为,可能需要实施 立方体中的某些行为。例如,一个类型的属性 维度可以设置为 Accounts 以向客户应用程序指示 标准维度包含帐户属性。

+-----------------+---------------------------------------------------------------------------+
| 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                                                             |
+-----------------+---------------------------------------------------------------------------+

【问题讨论】:

    标签: ssas mdx


    【解决方案1】:

    你可以自己试一试。让我们选择 ParallelPeriod 函数:

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

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

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

    除此之外,它只是客户端信息。客户端可以为不同类型使用不同的图标等等。

    【讨论】:

    • 感谢您的回复。我将帖子([Measures].[Lbs Sold],[INVOICE_DATE].[DATES].CurrentMember.PrevMember) 中的第一个MDX 脚本更改为计算中的层次结构([Measures].[Lbs Sold],[DATES].[DATE_STRUCTURE].CurrentMember.PrevMember)。我不再收到错误消息。所以我猜你必须使用层次结构?但是,当我使用字段([YR]、[PERIOD])或层次结构构建报告时,计算似乎是双向的。 MDX 令人困惑...
    • 我还应该说,我不认为 TYPE 'Time' 对 MDX 功能有影响。我认为它只是使用层次结构而不是字段。
    • 是的,你是对的。 MDX 与维度类型无关。
    猜你喜欢
    • 2021-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-27
    • 2011-11-03
    • 1970-01-01
    • 1970-01-01
    • 2022-08-08
    相关资源
    最近更新 更多