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

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,214,516
Messages
6,119,978
Members
448,934
Latest member
audette89

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