Results 1 to 2 of 2

Thread: GetPivotData - floating reference - on PowerPivot

  1. #1

    GetPivotData - floating reference - on PowerPivot



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hello All,
    I have recently started on PowerPivot and love it.

    I am trying to do 'GETPIVOTDATA' function from it though and got confused by the following. (Note that I purposely did not want to use CUBEVALUE).
    I am trying to GETPIVOTDATA from pivot table similar like below. I'm trying to make it floating reference, so I wanted to replace the year and month with cell reference; (highlighted in red) below.
    I have found out that I'm supposed to do ["&...&"] but I'm not sure what the . between 2014 (2.014) refers to, and the . between month 12 (1.2) refers to. Also, not sure why it gives me the E3 and E1 reference eventhough it refers to nothing in my power pivot.

    Any help would be greatly appreciated.
    Note that this pivot table is obtained from data which is linked to sql connection instead of table; hence may be the reason it says [Query] instead of [Table].
    Thanks!
    GETPIVOTDATA("[Measures].[Sum of salesvalue]",$B$5,"[Query].[Year]","[Query].[Year].&[2.014E3]","[Query].[Month]","[Query].[Month].&[1.E1]")
    GETPIVOTDATA("[Measures].[Sum of salesvalue]",$B$5,"[Query].[Year]","[Query].[Year].&[2.014E3]","[Query].[Month]","[Query].[Month].&[1.2E1]")

    Example of pivot table:
    Sum of salesvalue Column Labels
    2014
    Row Labels 1 12
    Product A $100 $908
    Product B $67 $605

  2. #2
    Neophyte Mac's Avatar
    Join Date
    Aug 2021
    Location
    Middlesbrough, UK
    Posts
    4
    Articles
    0
    Excel Version
    2019 and Deskyop Office 365
    Hi Casper,


    The getpivotdata response to me request was as follows:


    =getpivotdata(“[Measures].[Actual],TB_Pivots!$G$421,”[Subj Hierarchy].[TB Activity L1]” ,”[Subj Hierarchy].[TB Activity L1].&[Education and Training]”)


    The data field
    “[Measures].[Actual]” was changed to “[Measures].[“ & C$11 & “]” in which Actual was typed into cell C11.


    Pivot table
    TB_Pivots!$G$421 is the worksheet and first cell of the pivot table. Note it’s anchored.


    Field 1
    ”[Subj Hierarchy].[TB Activity L1]” is the query and the field within that query to be searched.


    Item 1
    ”[Subj Hierarchy].[TB Activity L1].&[Education and Training]” to ,”[Subj Hierarchy].[TB Activity L1].&[“ & $B13 & “]”


    The anchoring allowed me to copy and paste to other cells to ensure the correct values were returned.


    Regards
    Mike

Posting Permissions

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