+ Reply to Thread
Results 1 to 10 of 10

How to compare 2 fields and their percentage in a single pivot table and chart?

  1. #1
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    945

    How to compare 2 fields and their percentage in a single pivot table and chart?

    Hi all,

    Hope all are well.

    In attached file, i have set of batch / pack and incident data. I want to compare batch count, pack qty w.r.t incident count in a single pivot table and chart along with their percentages. Example for pivot and charts is in Pivot sheet.

    The sheet data will be populated each month and so the pivot and chart should update automatically.

    Can someone please help

    Thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,820

    Re: How to compare 2 fields and their percentage in a single pivot table and chart?

    This proposal employs the data model which should be included in the 2021 version of Excel.
    After the Table2 is loaded to the data model five measures are added
    1. Count of Lot Number:=COUNTA([Lot Number])
    2. Count of Incident Number:=COUNTA([Incident Number])
    3. Percent of Incidents:=[Count of Incident Number]/[Count of Lot Number]
    4. Sum of Pack Qty:=SUM([Pack Qty])
    5. Percent of Pack Qty:=[Count of Incident Number]/[Sum of Pack Qty]
    The measures are then used in the Values area of the respective pivot tables (Packs and Lots)
    Note that to see the chart for the month instead of by the day select the collapse (-) button in cell B4.
    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.

  3. #3
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    945

    Re: How to compare 2 fields and their percentage in a single pivot table and chart?

    Hi JeteMc,

    Thanks a bunch.

    However, count of incidents don't seem to be correct. There aren't 28 incidents on 02-02-2025 and so on

  4. #4
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,820

    Re: How to compare 2 fields and their percentage in a single pivot table and chart?

    To do useful analysis I feel that you will need to restructure the data in Table2 into records similar to what is modeled on the Data sheet.
    To be honest I am not sure that I can produce the kind of pivot table and chart that you want from this new version of Table2, however I don't see a path forward using the original setup.
    Let us know what you decide or if you have any questions.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    945

    Re: How to compare 2 fields and their percentage in a single pivot table and chart?

    Hi JeteMc,

    Can you help in creating 2 different pivot tables instead of 1. In attached sheet, i have separated 2 tables containing No. of Incidents and No. of Lot. Now i require a column in pivot table which shall show % for No. of Incidents / No. of lots in a month. I tried but it takes total and shows 88.03% for all months. (Since I require 100-%, so value is 88 instead of 12)

    In next sheet i want No. of Incidents and Sum. of Pack Qty. I again require a column in pivot table which shall show % for No. of Incidents / Sum of pack qty in a month. Also, i see that the grand total for pack qty shows as incorrect. Not sure where i am going wrong.

    Can you please help?
    Attached Files Attached Files
    Last edited by rizwanulhasan; 02-14-2025 at 11:25 PM.

  6. #6
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,820

    Re: How to compare 2 fields and their percentage in a single pivot table and chart?

    See if what is on the Pack vs. Incident sheet is what you want.
    If so I'll work on the Batch vs. Incident sheet later providing someone else has not already done so before then.
    Let us know if you have any questions.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    945

    Re: How to compare 2 fields and their percentage in a single pivot table and chart?

    Yes, its correct. However, as mentioned earlier, i dont think the grand total for Pack Quantity is correct

    Also count of Lots in sheet Batch Vs Incident needs to be corrected

  8. #8
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,820

    Re: How to compare 2 fields and their percentage in a single pivot table and chart?

    The Grand Total for Pack Quantity agrees with the amount on the Table 1 sheet when Table 1 is filtered to show only Type "Incident": 42,329,611
    Please tell us what the grand total for Pack Quantity should be or at least why you think that it is not correct.
    The source table for the data model tab DataTable 1 and the pivot table on the Batch vs. Incident sheet is not available.
    Let us know if you have any questions.
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    01-01-2022
    Location
    India
    MS-Off Ver
    Home 2021
    Posts
    945

    Re: How to compare 2 fields and their percentage in a single pivot table and chart?

    @JeteMc:

    Apologies for delayed response. I used power query and that increased the file size. So i was unable to upload the file.

    You are right about the sum. I got confused as I am not used to power query. My bad, and many thanks for your help.

  10. #10
    Forum Guru
    Join Date
    08-28-2014
    Location
    USA
    MS-Off Ver
    Excel 365 version 2501
    Posts
    18,820

    Re: How to compare 2 fields and their percentage in a single pivot table and chart?

    You're Welcome and thank you for the feedback. Please take a moment to mark the thread as 'Solved' using the thread tools menu above your first post. 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. How to compare 2 pivot tables in a single chart?
    By rizwanulhasan in forum Excel Charting & Pivots
    Replies: 12
    Last Post: 09-05-2023, 04:51 AM
  2. How do I calculate a percentage between fields in a pivot table?
    By plasteredric in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 07-18-2020, 11:06 AM
  3. Replies: 5
    Last Post: 05-22-2017, 03:21 AM
  4. Pivot Chart depicting percentage of total of single colum
    By TitansGo in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-15-2016, 09:36 PM
  5. Compare Pivot Table Columns to show Percentage Change
    By PTables in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 01-29-2016, 02:52 AM
  6. Replies: 5
    Last Post: 06-08-2012, 03:24 PM
  7. [SOLVED] Pivot Table - Compare 2 fields?
    By Erin in forum Excel General
    Replies: 0
    Last Post: 06-01-2006, 03:35 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