Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Date calculations in cross tab Post Reply Post New Topic
Author Message
sunnyday
Newbie
Newbie


Joined: 26 Jul 2010
Online Status: Offline
Posts: 8
Quote sunnyday Replybullet Topic: Date calculations in cross tab
     Posted: 14 Jul 2011 at 6:22am
Hello,
I have crystal reports 2008 and i am creating a report that uses a crosstab to summarize dates. I need to add a column that calculates the difference between 2 summarized dates.
I tried using the calculated member option, but it only works on numbers, so it won't calculate the number of days that is the difference between 2 dates. It will only display today's date in all the rows in the calculated column.
Is there any way around that?
Thanks!
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 14 Jul 2011 at 7:12am
did you try the datediff formula?
sharona
IP IP Logged
sunnyday
Newbie
Newbie


Joined: 26 Jul 2010
Online Status: Offline
Posts: 8
Quote sunnyday Replybullet Posted: 14 Jul 2011 at 7:45am
yes i did, but i kept getting an error message about the formula being supposed to return a date, which means that the calculation column is expected to be of the same type as the summaries!
obviously, i need the difference in days, which is a number.
 
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 14 Jul 2011 at 7:59am

the datediff function should return a number not a date

sharona
IP IP Logged
sharona
Senior Member
Senior Member
Avatar

Joined: 16 Oct 2008
Location: United States
Online Status: Offline
Posts: 255
Quote sharona Replybullet Posted: 14 Jul 2011 at 8:00am

DateDiff("d", {table.startdate}), {table.enddate})

sharona
IP IP Logged
sunnyday
Newbie
Newbie


Joined: 26 Jul 2010
Online Status: Offline
Posts: 8
Quote sunnyday Replybullet Posted: 14 Jul 2011 at 10:04am
yes i know, and that is what i want, except that the calculated member formula is refusing it, and what the return type to be a date, to match the other summaries, and this is exactly my problem.
 
So i was wondering if there was a way around it, so that i can have numbers in the calculation fields, not dates.
 
Thank you
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum