+ Reply to Thread
Results 1 to 4 of 4

calculated field in excel pivot

  1. #1
    Registered User
    Join Date
    03-12-2013
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    4

    Unhappy calculated field in excel pivot

    Hi Excel Gurus,

    I need help to solve this scenario.

    My Raw data has columns MS2010

    Name Lead Break Lunch BioBreak
    Abhishek Amit Pankaj 0:00:00 0:00:00 0:00:00
    Kreetika Amit Pankaj 0:19:31 0:33:06 0:00:00
    tiwari Amit Pankaj 0:00:00 0:00:00 0:13:28
    Kreetika Amit Pankaj 0:00:00 0:00:00 0:13:53
    Sharma Amit Pankaj 0:04:30 0:33:46 0:00:00
    tiwari Amit Pankaj 0:00:00 0:29:22 0:05:26
    subham Amit Pankaj 0:00:00 0:30:25 0:00:00
    sumit Amit Pankaj 0:19:09 0:33:44 0:08:59

    I made calculated columns - all break which is a sum of all three breaks and worked properly
    now i made a another calculated column with elapsed time =IF((HOUR('All breaks' )-1)<0,0,SUM(('All breaks' )-TIME(1,0,0)))

    I get the right elapsed time when i look with each names but the subtotal is giving incorrect answer ,

    can anyone help me fixing this , much appreciate your response.


    Sam
    Attached Files Attached Files
    Last edited by aiims; 06-05-2018 at 10:03 AM. Reason: format

  2. #2
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    MS365 Apps for enterprise
    Posts
    5,887

    Re: calculated field in excel pivot

    Simply put, you can't have desired value in SUBTOTAL/TOTAL column using calculated field in standard pivot table.

    Since you are subtracting constant, Time(1,0,0).

    In calculated field, SUM is performed on column(s) before any other calculations are applied. Hence, total will evaluate to SUM('All breaks') - Time(1,0,0).

    You will need additional column in source table. Or PowerPivot (only available for Excel 2010 or later, and depends on SKU).
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  3. #3
    Registered User
    Join Date
    03-12-2013
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    4

    Re: calculated field in excel pivot

    Thank you CK76 for the reply,

    Yes adding column will give a solution but since it's gonna be manual work therefore was looking for calculated field,

    Appreciate your support here,Thank you

    Regards
    Sam

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

    Re: calculated field in excel pivot

    You wouldn't need manual work, you could add the columns for ALL BREAKS and ELAPSED TIME using the following formulas respectively:
    =IF(COUNTIF(A$2:A2,A2)=1,SUMPRODUCT((A$2:A$9=A2)*(C$2:E$9)),"")
    =IFERROR(IF(F2<1/24,0,F2-1/24),"")
    Your Pivot Table will then show a Grand Total for the Elapsed Time of 8:22
    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.

+ 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 Field based on Running Total Field
    By EvolvingMonkey in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 09-07-2016, 06:27 AM
  2. Replies: 0
    Last Post: 08-15-2016, 02:07 PM
  3. Replies: 1
    Last Post: 12-21-2012, 05:40 AM
  4. Replies: 0
    Last Post: 06-26-2012, 09:06 PM
  5. Excel 2007 : Excel 2007 - Pivot Calculated Field
    By cleveregg in forum Excel General
    Replies: 2
    Last Post: 09-20-2008, 11:50 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. Excel 2002 Pivot Table calculated field percentage.
    By ~Dave in forum Excel General
    Replies: 3
    Last Post: 08-03-2005, 02:05 PM

Tags for this Thread

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