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.
Asked
Active
Viewed 2,983 times
2 Answers
1
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])

Darren Gosbell
- 1,941
- 13
- 17
-
1That is a good idea. I know I mentioned year-to-year in my question but they may also want to look at month-to-month or quarter-to-quarter. I would have to create three of these measures and teach them which one to use... I just can't figure out why the default Excel functionality won't work when the data source is a SQL Server cube... Thanks! – Jul 07 '09 at 18:08
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;

Alex
- 2,011
- 3
- 21
- 27