+ Reply to Thread
Results 1 to 7 of 7

Pivot table shows irrelevant rows when added a Calculated Item

  1. #1
    Registered User
    Join Date
    08-09-2020
    Location
    South Korea
    MS-Off Ver
    2016
    Posts
    2

    Pivot table shows irrelevant rows when added a Calculated Item

    Good day!

    Can you please help me with a question in using a pivot table?

    Using sample data, I want to add Calculated Item in a pivot table.

    The structure of the PivotTable:

    Filter: Category
    Row: Product
    Columns: Region
    Values: Sum of Quantity

    It shows 3 rows of Products when I chose Cookies for the Category.

    Then I added a Calculated Item giving Formula West/East to show the Difference. However the pivot table added extra rows for Products which don't belong to these 2 Regions.

    How can I only keep/show the 3 rows of these 2 regions (not the rows with Calculated Items #DIV/0!?

    Thank you.

    C3806.png
    Attached Files Attached Files

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

    Re: Pivot table shows irrelevant rows when added a Calculated Item

    Hello Angjian and Welcome to Excel Forum.
    This is an inelegant proposal that hopefully someone can improve upon.
    1. Save the data in the Sales_Data table into a data model
    2. Add the following measure: Difference:=CALCULATE(SUM([Quantity]),Sales_Data[Region]="West")/CALCULATE(SUM([Quantity]),Sales_Data[Region]="East")
    3. Produce a pivot table from the data model
    4. When the filters for both pivot tables are set to Cookies the other products are not show.
    For aesthetics you could hide columns M:N
    Sorry not to have been of more help.
    Last edited by JeteMc; 08-13-2020 at 07:56 PM. Reason: Removed file in favor on one attached to post #4
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Pivot table shows irrelevant rows when added a Calculated Item

    Maybe like this (see the pivot table in the attached file).
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

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

    Re: Pivot table shows irrelevant rows when added a Calculated Item

    I added two more measures
    West:=CALCULATE(SUM([Quantity]),Sales_Data[Region]="West")
    East:=CALCULATE(SUM([Quantity]),Sales_Data[Region]="East")
    I still feel that there should be an easier way, however I also feel that this is the output you want.
    Let us know if you have any questions.

    Edit: Difference:=[West]/[East]
    Attached Files Attached Files
    Last edited by JeteMc; 08-13-2020 at 07:42 PM. Reason: Added edit and update

  5. #5
    Registered User
    Join Date
    08-09-2020
    Location
    South Korea
    MS-Off Ver
    2016
    Posts
    2

    Re: Pivot table shows irrelevant rows when added a Calculated Item

    JeteMc, oeldere, Thank you both for sharing the knowledge which is really an eye opener! much appreciated!

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Pivot table shows irrelevant rows when added a Calculated Item

    Glad I could help.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

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

    Re: Pivot table shows irrelevant rows when added a Calculated Item

    You're Welcome and thank you for the feedback. I hope that you have a blessed day.

+ 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. Pivot Table - Calculated Item adds unnecessary rows
    By elderwand in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-10-2020, 12:14 PM
  2. Creating calculated field and calculated item into a pivot table
    By dvpe in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 12-12-2019, 12:15 PM
  3. Pivot table with Calculated Item with Two Rows Label
    By vinaynaran in forum Excel General
    Replies: 1
    Last Post: 07-29-2016, 12:06 PM
  4. Pivot table - calculated item
    By mingali in forum Excel General
    Replies: 1
    Last Post: 06-23-2010, 07:00 AM
  5. Replies: 1
    Last Post: 10-06-2009, 04:01 AM
  6. [SOLVED] pivot table formulas for calculated field or calculated item
    By Vicky in forum Excel General
    Replies: 3
    Last Post: 06-06-2006, 12:10 AM
  7. Replies: 1
    Last Post: 02-08-2006, 11:03 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