Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel 2007 Pivot tables calculated field returns zero

Status
Not open for further replies.

dentarthurdent

Technical User
Jul 2, 2002
95
GB
I have a pivot table with 2 date fields in it (as rows). I want to add a calculated field that simply tells me the difference (in days) between those 2 dates.

No matter what formula I use to calculate the date difference, the field always returns zero for all rows.
I must be misunderstanding something here but I don't know what!

Example of what I want:

Record # Date1 Date2 Calc field(data area)
001 2011-06-22 2011-06-28 6
etc...

Please help!
 
Hi,
What formula(s) have you tried? If you post those, we will have a little more information to work with and may be able to help.


Best,
Blue Horizon [2thumbsup]
 



hi,

Difference in days is simply the mathematical difference between two REAL DATES.



Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I have tried simple arithmetic date subtraction, days360 function and the datedif function. I think it must be that I need to convert date formats to a number first? What confuses me is that any of these methods work fine on the source data.
 


If your dates are in a PT Row/Column field, they may be converted to STRINGS.

Why does this have to be done using PT values?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
I thought about the dates maybe being in the wrong format so I formatted the cells as dates - still no luck.

As for why it has to be done in the PT, well it doesn't really. I am building this pivot for a bunch of non-techy users who simply want to be able to hit a button to refresh the data and update a chart automatically. The source data comes from a SQL database connection. I thought I could use calculated fields for this but I can simply add a column to the source data to calculate this instead.

Just a pity, as I thought this was exactly the sort of purpose that calculated fields were for?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top