使用“将值显示为” 当源是 SSAS 多维数据集时 Excel 2007 数据透视表中的选项?

发布于 2024-07-22 10:04:32 字数 288 浏览 9 评论 0原文

我有一个 Excel 2007 数据透视表,顶部显示“年份”,侧面显示“月份”。 我想要做的是将值表示为与上一年同月的“%差异”。 (例如,如果 07 年 1 月为 100,000 美元,08 年 1 月为 120,000 美元,我希望 08 年 1 月显示“20%”)。 但是,每次我尝试执行此操作(使用值字段设置的“将值显示为”选项卡)时,我的所有数字都会变为“#N/A”。 有没有办法使用 Analysis Services 多维数据集作为数据源来执行此操作? 当我使用不同工作表上的数据作为数据透视表的数据源执行完全相同的操作时,它工作得很好。

I have an Excel 2007 pivot table showing "Year" across the top and "Month" down the side. What I am trying to do is represent the values as "% Difference" from the same month of the previous year. (Ex. If Jan-07 is $100,000 and Jan-08 is $120,000, I would like Jan-08 to show '20%'). However, every time I try to do this (using the "Show values as" tab of Value Field Settings) all of my numbers go to '#N/A'. Is there a way to do this using an Analysis Services cube as the data source? When I do this exact same thing using data on a different sheet as the data source for the pivot table, it works fine.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

巾帼英雄 2024-07-29 10:04:32

我不确定在 Excel 中是否有任何方法可以执行此操作,但您可以在多维数据集中创建一个计算度量来执行此操作。

MDX 表达式如下所示:

([Measures].[Amount] - ([Date].[Year].PrevMember, [Measures].[Amount])) 
/ ([Measures].[Amount])

I'm not sure if there is any way of doing this in Excel, but you could create a calculated measure in your cube that would do it.

The MDX expression would look something like the following:

([Measures].[Amount] - ([Date].[Year].PrevMember, [Measures].[Amount])) 
/ ([Measures].[Amount])
标点 2024-07-29 10:04:32

参考周期与周期的比较,您可以使用以下计算脚本。
YearMonthDate 是日期维度上的层次结构,但您也可以根据需要在其中包含季度。

/* CALCULATE命令控制叶单元的聚合
立方体。 如果删除或修改了 CALCULATE 命令,则其中的数据
立方体受到影响。 仅当您满足以下条件时才应编辑此命令
手动指定多维数据集的聚合方式。
*/

CALCULATE; 
CREATE MEMBER CURRENTCUBE.[MEASURES].PrevPeriod
 AS ([Measures].[Count],  [Date].[YearMonthDate].CURRENTMEMBER.PREVMEMBER ), 
FORMAT_STRING = "#,#", 
VISIBLE = 1  ; 

CREATE MEMBER CURRENTCUBE.[Measures].PeriodChange
 AS ([Measures].[Count] - [Measures].[PrevPeriod]), 
FORMAT_STRING = "#,#", 
VISIBLE = 1  ;     
CREATE MEMBER CURRENTCUBE.[Measures].PercentChange
 AS (
        [Measures].[PeriodChange]/
        IIF(    ([Measures].[PrevPeriod] = 0), 
                [Measures].[Count],
                [Measures].[PrevPeriod]
            )
    ), 
FORMAT_STRING = "Percent", 
VISIBLE = 1;     
CREATE MEMBER CURRENTCUBE.[Measures].YearToDate
 AS (
       SUM(PeriodsToDate([Date].[YearMonthDate].[Year Code]), [Measures].[Count])
    ), 
FORMAT_STRING = "#,#", 
VISIBLE = 1;

Ref period to period comparisons, you could use the following calculation script.
YearMonthDate is the hierarchy on the date dimension, but you could have quarter in there too for your requirement.

/* The CALCULATE command controls the aggregation of leaf cells in the
cube. If the CALCULATE command is deleted or modified, the data within
the cube is affected. You should edit this command only if you
manually specify how the cube is aggregated.
*/

CALCULATE; 
CREATE MEMBER CURRENTCUBE.[MEASURES].PrevPeriod
 AS ([Measures].[Count],  [Date].[YearMonthDate].CURRENTMEMBER.PREVMEMBER ), 
FORMAT_STRING = "#,#", 
VISIBLE = 1  ; 

CREATE MEMBER CURRENTCUBE.[Measures].PeriodChange
 AS ([Measures].[Count] - [Measures].[PrevPeriod]), 
FORMAT_STRING = "#,#", 
VISIBLE = 1  ;     
CREATE MEMBER CURRENTCUBE.[Measures].PercentChange
 AS (
        [Measures].[PeriodChange]/
        IIF(    ([Measures].[PrevPeriod] = 0), 
                [Measures].[Count],
                [Measures].[PrevPeriod]
            )
    ), 
FORMAT_STRING = "Percent", 
VISIBLE = 1;     
CREATE MEMBER CURRENTCUBE.[Measures].YearToDate
 AS (
       SUM(PeriodsToDate([Date].[YearMonthDate].[Year Code]), [Measures].[Count])
    ), 
FORMAT_STRING = "#,#", 
VISIBLE = 1;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文