+ Reply to Thread
Results 1 to 2 of 2

Getpivotdata For Related Tables!!

  1. #1
    Registered User
    Join Date
    04-18-2019
    Location
    Hanoi, Vietnam
    MS-Off Ver
    2013
    Posts
    1

    Getpivotdata For Related Tables!!

    Hello everyone, first time here.

    I've been tasked with updating an old reporting spreadsheet so it pulls data from a SSAS model rather than have to be manually updated at the end of each month.

    There's 3 important data points, the account number, the period number, and the period balance. I thought the best way to do this without changing the format of the reporting sheet is to create a new page with the SSAS data on a pivot table, then use GetPivotData to update just the period balance cell on the old sheet. The data model consists of a fact_balances table that contains the period balance, and dim_chart_of_accounts that contains the account number, the two tables are related.

    When I used the "generate getpivotdata" function, excel gave this formula.
    =GETPIVOTDATA("[Measures].[period_balance_sum]",'Model Pivot'!$A$2,"[fact_balances].[period]","[fact_balances].[period].&[1]","[Dim_chart_of_account].[account_no]","[Dim_chart_of_account].[account_no].&[100100010]")
    [Measures].[period_balance_sum] is the value GetPivotData is looking for, the period balance of a specific account and month

    'Model Pivot'!$A$2 is where my pivot table starts

    "[fact_balances].[period]" is field 1, the column on the fact_balances tables that denotes the period

    "[fact_balances].[period].&[1]" is item 1. Here's the strange part, rather than just looking up 1 for period 1, like in the getpivotdata tutorials, the table and column is also included

    "[Dim_chart_of_account].[account_no]" is field 2, which is the account number.

    "[Dim_chart_of_account].[account_no].&[100100010]" is item 2. Just like item 1, it has the table and column name included, rather than just 100100010

    What I want to do is instead of having the period and account number hard coded into each getpivotdata, have them reference a column containing the account number. However, simply replacing the items with the cell reference doesn't work. I think it has to do with the way the fields and items are formatted in the formula that excel generated.

    Can anyone give some insight into this problem?

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 2019
    Posts
    17,543

    Re: Getpivotdata For Related Tables!!

    Hello vudiemphuongchi and Welcome to Excel Forum.
    It may be easier to help if you could upload a small desensitized sample of the raw data and pivot table. Be sure to give us some expected results, I imagine that you will just need to manually type them, so that we will know whether or not our formulas/code are yielding the correct results.
    To upload a sample workbook (not a picture or pasted copy) click on the GO ADVANCED button below the Quick Reply window and then scroll down to Manage Attachments to open the upload window.
    Let us know if you have any questions.
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Getpivotdata for related tables
    By codextero in forum Excel General
    Replies: 0
    Last Post: 08-14-2018, 04:42 PM
  2. I want to extend related tables that have related formulas
    By earlyyyyyy in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 10-10-2015, 10:08 AM
  3. GETPIVOTDATA function using 2 pivot tables
    By macquhele in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 12-10-2012, 06:41 PM
  4. [SOLVED] Two related tables
    By gerainta in forum Excel General
    Replies: 3
    Last Post: 05-15-2012, 05:59 AM
  5. Question related to Pivot Tables
    By y.farkash in forum Excel General
    Replies: 2
    Last Post: 09-13-2010, 01:04 PM
  6. [SOLVED] Related Tables - Access 2000
    By Leonard Priestley in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-20-2006, 06:10 AM
  7. Pivot Tables and the getpivotdata formula
    By Maxxin in forum Excel General
    Replies: 8
    Last Post: 12-06-2005, 06:10 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1