+ Reply to Thread
Results 1 to 5 of 5

Pivottable formula that uses Values from Pivot Table

  1. #1
    Registered User
    Join Date
    09-17-2020
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    2

    Pivottable formula that uses Values from Pivot Table

    Hi,

    In the attached xlsx file with a pivot table in which I would like to calculate the average percentage by dividing the "Sum of %" by the "Count of X".
    Is it possible to insert this calculation in the Pivot in a simple way somehow?

    Thank you in advance,
    Sincerely
    Hjallis
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Pivottable formula that uses Values from Pivot Table

    You can add a calculated field for that.

    Select the pivot table, goto PivotTable Analyze>Fields, Items & Sets>Calculated Field...

    Enter an appropriate name for the field, enter this formula,

    ='%' /X * 10

    and click Add then OK.

    The new field should now appear in the pivot table and you can change it's format by right clicking it and selecting Number Format...
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    09-17-2020
    Location
    Sweden
    MS-Off Ver
    Office 365
    Posts
    2

    Re: Pivottable formula that uses Values from Pivot Table

    Thanks Norie for you replay,
    Unfortunately I was not completely clear in my example before, the value of X is not always 10 but could be any number big or small, negative or positive. So I can't use the multiplier "10".

    What I think I need to use is the Field "Count of X" somehow... The Value of X is not important, only how many time it is true.

    please see my new attachment.

    Thanks again!
    Hjallis
    Attached Files Attached Files

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

    Re: Pivottable formula that uses Values from Pivot Table

    Hello Hjallis and Welcome to Excel Forum.
    I would imagine that someone may be able to do what you want using explicit measures applied to the data placed in the data model.
    As four days have passed I thought that I might offer a formula based alternative, until such time as the above is offered.
    The Modell column is populated using: =IFERROR(INDEX(Table1[Modell],MATCH(0,INDEX(COUNTIF(F$4:F4,Table1[Modell]),,),)),"")
    The Sum of % column is populated using: =IF(F5="","",SUMIFS(Table1[%],Table1[Modell],F5))
    The Count of X column is populated using: =IF(F5="","",COUNTIFS(Table1[Modell],F5,Table1[X],"<>"))
    The %/X column is populated using: =IF(F5="","",G5/H5)
    Let us know if you have any questions.
    Attached Files Attached Files
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

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

    Re: Pivottable formula that uses Values from Pivot Table

    OK, I fudged a bit on this by adding another column (Count X) to the data.
    Count X is populated using: =IF([@X]<>"",1,0)
    The data is then placed in the data model and three measures are added:
    Sum of %:=SUM(Table1[%])
    Count of X:=SUM(Table1[Count X])
    %/X:=[Sum of %]/[Count of X]
    Note that the Sum of % and %/X are formatted in the data model so that they will not need to be formatted again when the pivot table is produced.
    The three measures are then used in the pivot table modeled on the Table sheet.
    Let us know if you have any questions.
    Attached Files Attached Files

+ 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. [SOLVED] Calculated Formula Pivot Table Values - DSO
    By jmcconville18 in forum Excel General
    Replies: 4
    Last Post: 06-26-2014, 11:41 AM
  2. [SOLVED] Count Unique Values Formula/Pivot Table
    By mgibbonsjr in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 12-06-2013, 02:36 AM
  3. Calculate Table Values using a PivotTable
    By theshaun in forum Excel Charting & Pivots
    Replies: 10
    Last Post: 02-26-2013, 09:01 AM
  4. [SOLVED] Formula selection - Vlookup? Match? Pivot table? Returning multiple values
    By enigmaes in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 09-21-2012, 12:21 PM
  5. Replies: 5
    Last Post: 12-14-2008, 02:32 PM
  6. formula to get values from pivot table
    By Minerva in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-15-2006, 09:45 AM
  7. Replies: 1
    Last Post: 06-24-2005, 02:05 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