Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Last Date/Time of previous month Post Reply Post New Topic
Author Message
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Topic: Last Date/Time of previous month
    Posted: 08 Aug 2014 at 2:40am
Afternoon all,

I currently have the below fields in my Crystal Report (crosstab). What I am trying to do is set the criteria so that only the very last date/time combination is shown from last month.

Date&Time (Row)
ComputerName (Column)
DiskID (Column)
Avg of DiskSizeMB (Summarized)
Avf of DiskUsedPct (Summarized)

What I thought would work is the below formula but unfortunately this doesn't work due to an error ("This function cannot be used because it must be evaluated later.").  Is there another way to achieve this??

{Table1.DATE_TIME} in LastFullMonth and
{Table1.DATE_TIME} = Maximum({Table1.DATE_TIME})

IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 08 Aug 2014 at 5:07am
why not a formula like:
local datetimevar nmonth = dateadd("month",1,{table.field});
dateadd("d",-1,date(year(nmonth),month(nmonth),1));

this will always give the last day of the month.
first we add a month to the date, then we create a date that is the first of that month(the next month)
then we subtract 1 day, which is the last day of the month.

This does not need to be evaluated later, and should work for you to summarize off of.

HTH
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 08 Aug 2014 at 5:24am
Hi Lockwelle,

Unfortunately the data I am using is collected every 15 minutes so I have to get the last Date and also the last Time of the Date/Time field so must be summarised.

I may have found the solution with the following link: I am just testing to make sure it all works...

http://www.maximumimpactsolutions.co.uk/blog/comments.asp?bd=129
IP IP Logged
Dr4ke
Senior Member
Senior Member


Joined: 09 May 2014
Online Status: Offline
Posts: 209
Quote Dr4ke Replybullet Posted: 08 Aug 2014 at 5:31am
I can confirm that this has provided what was required.
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.078 seconds.