+ Reply to Thread
Results 1 to 8 of 8

Pivot - adding a calculated field

  1. #1
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Pivot - adding a calculated field

    Hello,
    Is there a way to add a calculated field that divides data by a variable? The attached sample file contains a Pivot table summarizing sales and cost data (Sales Volume, Fixed Costs, Revenue, Selling expenses, Variable costs) for multiple years and multiple companies (A & B). The Pivot has Company and Year Filed in Filters. I need to add a column to the Pivot which will calculate the sales and costs data (Parameters) per Sales Volume (one of the parameters), by dividing the parameters (fixed costs, Revenue, Selling Expenses) by the Sales Volume (Items Sold). The data Pivot should recalculate every time the new filter (company and year) is applied.
    Thank you!
    Attached Files Attached Files

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,270

    Re: Pivot - adding a calculated field

    Add the value field again, right-click the new copy and choose Show Values As, % of... then choose Parameter as the base field, and 'Sales Volume, items sold' as the base item.
    Remember what the dormouse said
    Feed your head

  3. #3
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Re: Pivot - adding a calculated field

    Great! Thank you!

  4. #4
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Re: Pivot - adding a calculated field

    It worked great in a simple example I provided. Now I have complicated things and added columns to the data. Now the pivot has multiple groupings, and the calculation is not working well. Can you tell me why I have N/A error in some rows?Example-Pivot per item sold_Rev 1.xlsxNA Error with Groupings.JPG

  5. #5
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,270

    Re: Pivot - adding a calculated field

    The 'Sales volume, items sold' field only has a value at Cost Center level for Sales, so you will get N/A at that level for both PPO and OpEx since there isn't a value to use as the base.

  6. #6
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,270

    Re: Pivot - adding a calculated field

    If you use the data model, you can do something like the attached, which I think is what you are after?
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    04-25-2019
    Location
    canada
    MS-Off Ver
    365
    Posts
    45

    Re: Pivot - adding a calculated field

    Awesome! When you wrote the DAX formula, did you type the "Sales Volume, items sold" in the filter or is there way to somehow look this value up/choose from a list the same way you can pick column headers?
    SalesVol:=CALCULATE(SUM([Content.Value]),Query2[Content.Parameter]="Sales Volume, items sold",ALL(Query2[Content.Cost Center]))

  8. #8
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,270

    Re: Pivot - adding a calculated field

    I wrote it in myself, but you could have a table of the parameters.

+ 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. Replies: 1
    Last Post: 09-25-2022, 09:06 AM
  2. Replies: 1
    Last Post: 01-15-2019, 08:54 PM
  3. adding calculated PowerPivot field to Pivot Table
    By AtlanteanIdol in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-09-2017, 09:49 AM
  4. adding a calculated field to power pivot data model
    By stephme55 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-26-2016, 07:13 PM
  5. Adding Percentile As a Calculated Pivot Field
    By nirvehex in forum Excel General
    Replies: 2
    Last Post: 09-01-2015, 03:10 PM
  6. Adding new calculated/column field to pivot table
    By MARYAN in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 09-09-2010, 05:34 AM
  7. Pivot Table - Adding Average as calculated field
    By Matt1234au in forum Excel General
    Replies: 4
    Last Post: 12-22-2009, 08:50 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