GETPIVOTDATA Syntax Error

ExcelAtEverything

Active Member
Joined
Jan 30, 2021
Messages
351
Office Version
  1. 2019
Platform
  1. Windows
Hello, I'm having trouble changing the BOLD portion of the following GETPIVOTDATA formula, to be dynamic. I've edited the Date & the Year parts already, but I keep getting a syntax error when I attempt change on the "Org #" part. The "Org #" part shown here is still from the original static code.

=GETPIVOTDATA("[Measures].[Sum of Total Discount]",'LY Discounts Yearly'!$B$3,
"[LY Orders Data Tab - Discounts].[Org #]","[LY Orders Data Tab - Discounts].[Org #].&[237]",
"[LY Orders Data Tab - Discounts].[Date]","[LY Orders Data Tab - Discounts].[Date].&["&TEXT($G$3-366,"yyyy-mm-dd") & "T00:00:00]",
"[LY Orders Data Tab - Discounts].[Date (Year)]","[LY Orders Data Tab - Discounts].[Date (Year)].&"&"["&YEAR($G$3-366)&"]")

My attempt which gave the syntax error was:
"[LY Orders Data Tab - Discounts].[Org #]","[LY Orders Data Tab - Discounts].[Org #].&[" &[@[Org '#]]& "]",

Thanks!

1619520384468.png
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
That looks correct to me.
 
Upvote 0
What's the whole formula as you are trying to enter it, and which part is highlighted after the error? I can enter it in a cell without issue.
 
Upvote 0
Hi Rory! Thx.

=GETPIVOTDATA("[Measures].[Sum of Total Discount]",'LY Discounts Yearly'!$B$3,
"[LY Orders Data Tab - Discounts].[Org #]","[LY Orders Data Tab - Discounts].[Org #].&[" &[@[Org '#]]& "]",
"[LY Orders Data Tab - Discounts].[Date]","[LY Orders Data Tab - Discounts].[Date].&[2020-08-31T00:00:00]",
"[LY Orders Data Tab - Discounts].[Date (Year)]","[LY Orders Data Tab - Discounts].[Date (Year)].&"&"["&YEAR($G$3-366)&"]"),
[@[Adj Total for 1st partial month LY]])

1619526603055.png
 
Upvote 0
Is that formula in the table? If not, you need to include the table name.
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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