+ Reply to Thread
Results 1 to 9 of 9

Calculated Field showing ZERO rather than correct value

  1. #1
    Registered User
    Join Date
    06-13-2012
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    35

    Calculated Field showing ZERO rather than correct value

    I've created a calculated field named 'EE_Hours' in a pivot table and it is incorrectly returning zero for all entries. The underlying data table has a 'Meas' field which are text entries. There is another field named 'Value' which is a number. If 'Meas' = 'Employees' I want to multiply 'Value' by 2,080/12 to get employee hours for the month. If not, I want to return zero. However it ALWAYS returns zero. Even when 'Meas' = 'Employees'. The formula I've entered for the calculated measure is:

    =SUM(IF(Meas= "Employees",Value * 2080/12,0))

    Any help on why might be this is happening is appreciated.

    Thanks

    Pivot_Calc.png

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Calculated Field showing ZERO rather than correct value

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and click "manage attachments" to open the upload window.


    To add a file to a post

  3. #3
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Calculated Field showing ZERO rather than correct value

    You can't do that with a calculated field. I'd suggest you just add a new column to your source data that does the calculation for you.
    Rory

  4. #4
    Registered User
    Join Date
    06-13-2012
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: Calculated Field showing ZERO rather than correct value

    Thanks for your reply rorya. I certainly can use the 'IF' statement since I can find several examples of this on Excel tutorial pages. I tried taking the SUM off and just going with this:

    =IF(Meas= "Employees",Value * 2080/12,0)

    Thinking that perhaps the SUM aggregation is actually not necessary. But I still get zeros...

    Why would this not work? Thanks.

  5. #5
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Calculated Field showing ZERO rather than correct value

    Calculated fields work at an aggregate level and any field is summed. Therefore your formula is effectively:

    =IF(SUM(Meas)= "Employees",SUM(Value) * 2080/12,0)

    Since SUM(Meas) is 0, not "Employees", you just get 0 back.

  6. #6
    Registered User
    Join Date
    06-13-2012
    Location
    Connecticut
    MS-Off Ver
    Excel 2010
    Posts
    35

    Re: Calculated Field showing ZERO rather than correct value

    Thanks for the explanation rorya. I'll have to go back to the drawing board on technique here then.

  7. #7
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,911

    Re: Calculated Field showing ZERO rather than correct value

    The simplest solution would be to add a column in the source data that does the calculation, then just sum that in the pivot table.

  8. #8
    Registered User
    Join Date
    06-21-2017
    Location
    Missouri, USA
    MS-Off Ver
    2007 through 2019
    Posts
    71

    Re: Calculated Field showing ZERO rather than correct value

    Just a thought and maybe I'm way off base, but is it possible that instead of Value the formula should say Sum of Value in order to match the column header?

  9. #9
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,480

    Re: Calculated Field showing ZERO rather than correct value

    See post #2

+ 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] Calculated Field in Pivot Table, Not Returning Correct If Function
    By egarcia7 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 03-09-2016, 12:49 PM
  2. Getting correct grand totals when using calculated field in pivot table
    By stephme55 in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 03-07-2016, 01:02 PM
  3. calculated field not showing up in pivot table
    By stephme55 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-27-2016, 03:23 AM
  4. Calculated Field showing average of whole team
    By Bishonen in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-10-2016, 09:26 AM
  5. Calculated field not showing when filtered
    By DARNEXCEL in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-10-2015, 03:01 PM
  6. Calculated Field Not Showing up as available Slicer??
    By freefaller6 in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 01-19-2014, 11:02 AM
  7. Showing a calculated field on Userform
    By Dreamwine59 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-10-2013, 02:28 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