+ Reply to Thread
Results 1 to 5 of 5

Combining Two Pivot Table Columns into one Sum

  1. #1
    Registered User
    Join Date
    07-17-2019
    Location
    Arizona
    MS-Off Ver
    Excel 2016
    Posts
    12

    Combining Two Pivot Table Columns into one Sum

    Hello everyone,

    Is it possible to combine two columns of data into one column with sums in a pivot table?

    I attached a sample spreadsheet of what I'm trying to accomplish. On a daily basis, we track tasks that people are doing. I would like a pivot table that tracks how much time each individual spends on each activity (a sum of all the days). For example, Anna spent 4 hours playing outside total (combining Activity 1 and Activity 2), and 6 hours total on a museum visit.

    Thank you for your help in advance.

    Anna
    Attached Files Attached Files

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Combining Two Pivot Table Columns into one Sum

    This is straightforward by transforming your source data, using Power Query (Get & Transform Data).

    Format your source data as a table, then use:

    Please Login or Register  to view this content.
    Close and Load To the Data Model, then create a Pivot Table from the Data Model:

    Capture.PNG
    Attached Files Attached Files
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    07-17-2019
    Location
    Arizona
    MS-Off Ver
    Excel 2016
    Posts
    12

    Re: Combining Two Pivot Table Columns into one Sum

    Hi Olly,

    Wow, this is super impressive, and I will definitely try to make this work with my data.

    However, I was hoping for a more simple solution, since a few of my colleagues will also be using this spreadsheet on a regular basis. Are there any other workarounds that may make this a bit more simple?

    Thank you again!

    Anna

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Combining Two Pivot Table Columns into one Sum

    Not really. Pivot tables work best with normalised data - one fact per row.

    Your data has two facts (with separate attributes) per row, which makes it difficult to pivot.

    The query normalises the data, which then allows it to be pivoted easily.

    The simplest solution would be to change the structure of your source data, so that only one Activity / Duration is captured per row.

  5. #5
    Registered User
    Join Date
    07-17-2019
    Location
    Arizona
    MS-Off Ver
    Excel 2016
    Posts
    12

    Re: Combining Two Pivot Table Columns into one Sum

    Thanks again, Olly! I did restructure the source data to have a column for each activity, and the number of hours for the duration to be written in the row based on day and person's name.

+ 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. [SOLVED] Combining columns in pivot table results.
    By Mr. H2 in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 01-04-2017, 11:37 AM
  2. Replies: 3
    Last Post: 05-24-2013, 06:24 PM
  3. Combining value count from multiple columns in pivot table
    By AFsimRA in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 02-05-2013, 11:29 AM
  4. Replies: 2
    Last Post: 05-21-2012, 10:56 AM
  5. Replies: 2
    Last Post: 05-03-2012, 01:18 PM
  6. Replies: 2
    Last Post: 08-16-2010, 06:40 PM
  7. Pivot Table combining multiple columns
    By Pete Petersen in forum Excel General
    Replies: 1
    Last Post: 01-13-2005, 04:06 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