+ Reply to Thread
Results 1 to 4 of 4

Ordering by Multiple Groups in Pivot Table

  1. #1
    Registered User
    Join Date
    05-01-2020
    Location
    Ireland
    MS-Off Ver
    2013
    Posts
    58

    Ordering by Multiple Groups in Pivot Table

    Hi there, I wonder if anyone can help me with ordering groups in a Pivot table (Rows area)?

    Please see attachment of 2 tabs "my data now" and "what I want".

    I want to sort my data, first in ascending order, where a Customer falls into more than 2 or more groups (example if he falls into groups 8 and 27)
    Below all of the multiple groupings of 8, 25 and 27, I would the the remainder of the Pivot for the Customer to be to be reported as just in one group (example group 8).

    I have outlined in the second tab, how I would want the data sorted.
    If this can be done in a Pivot table or a spreadsheet from this Pivot, I am ok with that.
    But its worth noting that I cannot change my source data. The Groups were created in my source data.
    Attached Files Attached Files
    Last edited by MarkJohn51; 05-25-2020 at 09:19 AM.

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

    Re: Ordering by Multiple Groups in Pivot Table

    Is this the same question that you are asking in the thread linked below?
    https://www.excelforum.com/excel-gen...ml#post5338367
    Consider taking the time to add to the reputation of everybody that has taken the time to respond to your query.

  3. #3
    Valued Forum Contributor
    Join Date
    03-24-2020
    Location
    Thailand
    MS-Off Ver
    Office 2016
    Posts
    897

    Re: Ordering by Multiple Groups in Pivot Table

    MarkJohn51,
    Would be more helpful if some actual sample data is in the file to see how the raw data is structured.

  4. #4
    Registered User
    Join Date
    01-05-2020
    Location
    Texas
    MS-Off Ver
    O365 ProPlus
    Posts
    3

    Re: Ordering by Multiple Groups in Pivot Table

    Use 'Data > Get & Transform > From Table/Range' to create a query on your source data.

    In the Power Query editor, add a custom column that categorizes the customer based on the number of groups they're in. This column definition will count the number of rows where 'Group' has the same value as the value in 'Group' on the current row. We can make a quick check to see if it's greater than or equal to 2 and categorize accordingly:

    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Close and load the query into a new sheet, then build the pivot table from the newly loaded table. You can put "category" in your pivot and sort it ascending to get the "2 or more" group at the top, then "group", sorted ascending within "category", then customer within each group.

    Note that when your pivot table is in Outline layout (as yours is), you need to right-click on an item from the field you want to sort, then choose the sort order. Do this for each field in the way that works for your goal.

    Attached is an example that includes the Query. Select the Green-formatted table on the "query output" sheet then click "Edit" on the Query tab of the ribbon to view the query definition.

+ 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 with Sub-Groups repeating for all Major Groups error
    By Carla77 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-24-2020, 01:38 PM
  2. Re-ordering a pivot table
    By didierkassas in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 03-07-2018, 03:25 AM
  3. [SOLVED] Chronological Ordering Of Time Periods In Pivot Table
    By bkahl34 in forum Excel Charting & Pivots
    Replies: 3
    Last Post: 05-24-2017, 05:25 PM
  4. Ordering Data Table under Pivot Chart
    By namharb616 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 09-15-2016, 01:47 AM
  5. [SOLVED] Ordering groups based on some criteria
    By Ucpaul in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-30-2015, 02:19 PM
  6. Newbie: Sorting Pivot Table into multiple groups??
    By luckyali in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 06-16-2014, 09:56 AM
  7. [SOLVED] Ordering chronologically in a pivot table
    By Falc in forum Excel Charting & Pivots
    Replies: 12
    Last Post: 07-30-2013, 09:11 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