Getpivotdata() with several elements for each field

reitan

New Member
Joined
May 14, 2008
Messages
4
I have some excel pivottable connected to a cube. The data are further used in excel by the getpivotdata() formula.

In the example below I have combined two getpivotdata() formulas to calculate the Budget variance. As you see the only difference of the "budget" and the "actuals" are the last element. "[Set].&[02.BGT]" vs "[Set].&[01.ACT]").

EXAMPLE:
Actuals =getpivotdata("[Measures].[Amount]";$A$6;"[TimeByYM]";"[TimeByYM].[Alle Måneder]";"[Set]";"[Set].&[01.ACT]")


Budget =getpivotdata("[Measures].[Amount]";$A$6;"[TimeByYM]";"[TimeByYM].[Alle Måneder]";"[Set]";"[Set].&[02.BGT]")

Budget variance =getpivotdata("[Measures].[Amount]";$A$6;"[TimeByYM]";"[TimeByYM].[Alle Måneder]";"[Set]";"[Set].&[01.ACT]") - getpivotdata("[Measures].[Amount]";$A$6;"[TimeByYM]";"[TimeByYM].[Alle Måneder]";"[Set]";"[Set].&[02.BGT]")


In more complex cases when I have to use 6-10 getpivotdata() formulas it is very difficult to read and maintain the formulas and mistakes may be done.

My Question:
=> Is it possible to make the formula shorter by using ony one getpivotdata() to get the budget variance?

For instance somthing like this?

=getpivotdata(....;;;;;"[Set].&[01.ACT] - [Set].&[02.BGT]")

in other cases I would like the sum of two departments wich are not grouped in the cube structure...
=getpivotdata(....;;;;;"[department].&[21] - [department].&[39]")

is this possible?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top