+ Reply to Thread
Results 1 to 6 of 6

filterable pivot chart count of "N" from multiple categories

  1. #1
    Registered User
    Join Date
    07-05-2023
    Location
    Illinois
    MS-Off Ver
    365
    Posts
    3

    filterable pivot chart count of "N" from multiple categories

    Hello,
    I'm trying to create a pivot chart from a table that will be added to on a daily basis by others. The chart can be filtered by columns A-E and will show the total N for each category (columns F-AD) based on the filter(s).
    See example chart tab for what the chart should like, but with filters.

    It's ideal if the chart would automatically sort by highest to lowest count.

    I've tried everything I can think of.

    Thanks for your help.

    Randy
    Attached Files Attached Files

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

    Re: filterable pivot chart count of "N" from multiple categories

    Hello virtualray and Welcome to Excel Forum.
    I am not sure that I completely understand the request, however a start may be to produce a filterable chart that sorts from highest to lowest based on the data at the top of the example chart sheet:
    1. Use Get & Transform (Power Query) to produce the green/white table on the tbl_ResultCount sheet using the following M-Code (see Power Query advanced editor):
    Please Login or Register  to view this content.
    2. Produce a pivot table and use more sort options to sort by values in descending order.
    3. Produce a chart from the pivot table.
    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 Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: filterable pivot chart count of "N" from multiple categories

    A bit of a Texas Two-Step here.

    The problem is that you have to convert the Y's to 1 and the N's to 0.

    I solved the issue with a couple of named dynamic ranges.

    One of them looks at the first 5 columns on the enter data sheet.Data_List =OFFSET('enter data'!$A$2,0,0,COUNTA('enter data'!$A:$A)-1,5) it gives an array equal to the number of rows for which there is data and 5 columns wide.

    On the shadow data sheet the formula in cell A2 is =Data_List. The rest of the columns have formulas copied down to about row 1200. This isn't elegant and I could do a neater job with VBA (and would have for a permanent solution). I overlaid this with another named dynamic range: Pivot_Data =OFFSET('Shadow Data'!$A$1,0,0,COUNTA('Shadow Data'!$A:$A),39). This range only looks at rows for which there is data. It is also the source for the Shadow Chart pivot table.

    I did not complete the pivot table on the shadow chart sheet, due to laziness .

    I suggest that instead of filters, you use slicers - they just look cooler.




    Then there's Pivot_Data =OFFSET('Shadow Data'!$A$1,0,0,COUNTA('Shadow Data'!$A:$A),39)
    Attached Files Attached Files
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,920

    Re: filterable pivot chart count of "N" from multiple categories

    I found a more elegant solution here.

    There is a sheet called Lookups. These are simple pivot tables and they give you a unique list for the various categories. I overlaid these with named dynamic ranges for data validation.

    The heavy lifting is done on the charts sheet. Cells B2:B8 have the dropdowns based on the data validations. Column C mimics the selected value. If (All) is selected the value is changed to * for a string value or the minimum for a numeric values. Numeric values are either equal to the selected value (if not all) or greater than or equal to the min value.

    Columns B:D, rows 11 to 35 contain the formulas to get the value associated with the item to track. I did items 1 to 14. It is left as an exercise to the student to complete the rest of the formulas.

    The remaining formulas are =COUNTIFS(Table1[1-correct inventory?],B$10,Table1[Auditor],Sel_Auditor,Table1[date],Date_Op&Sel_Date,Table1[shift],Sel_Shift,Table1[Mold],Sel_Mold,Table1[Week],Week_Op&Sel_Week,Table1[Month],Sel_Month,Table1[Year],Year_Op&Sel_Year)

    Change 1-correct inventory? to the value being tracked. The easiest way to do this is to blank out between the square brackets and type in the number (e.g. 15) and intellisense will suggest the column heading name to use. Press the tab key to accept the value then press enter.

    Once you completed cells B25:B35, you can copy / paste the formulas into the other two columns.

    Also, you will have to redo the chart once you get all the cells updated.

    About the only thing else to mention is that you must refresh the pivot table (any one will do since they are all based on the same data set) after adding or changing data. The lookups will update when the pivot tables update.
    Attached Files Attached Files

  5. #5
    Registered User
    Join Date
    07-05-2023
    Location
    Illinois
    MS-Off Ver
    365
    Posts
    3

    Re: filterable pivot chart count of "N" from multiple categories

    dflak,
    Thanks, that will work, I was hoping for something where I could filter by Y, N and NA
    But I can create a sperate shadow table for the Y and N responses. The NA responses are not critical.

    JeteMc,
    Thanks as well, I'll work on that when I get dflak's approach working the way we need it.

    Regards.

  6. #6
    Registered User
    Join Date
    07-05-2023
    Location
    Illinois
    MS-Off Ver
    365
    Posts
    3

    Re: filterable pivot chart count of "N" from multiple categories

    Attached is the workbook with sample data and charts.
    This works well for comparing results from 2 different filters
    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. Curious how to count 2 categories for total items in Pivot Table
    By mydarkpassenger in forum Excel General
    Replies: 1
    Last Post: 12-15-2019, 08:44 PM
  2. [SOLVED] Count of Multiple sub categories
    By krajivgandhi in forum Excel Formulas & Functions
    Replies: 17
    Last Post: 05-15-2017, 04:09 AM
  3. [SOLVED] Pivot Table/Chart to filter categories
    By Maxthelion in forum Excel Charting & Pivots
    Replies: 14
    Last Post: 05-20-2014, 10:26 AM
  4. [SOLVED] Add line chart to bar chart with multiple categories
    By EthanM in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 02-02-2014, 04:12 PM
  5. Filtering categories in Pivot Chart
    By pandyav in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 03-01-2013, 02:13 PM
  6. Replies: 1
    Last Post: 12-15-2012, 02:39 PM
  7. Chart with filterable legend
    By stuartmarsh in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 08-12-2006, 04:47 AM

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