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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

count datediff formula

Status
Not open for further replies.

Newbi1

Programmer
Apr 4, 2005
64
US
Is there anyway to count the number of records that have a datediff >0 in the group head for that group?


I am trying to get the number of records where the datediff between today and the due date of the record > 0.

I need to have the result in the group header opposed to the footer and it needs to work for each group.

Can this be done in CR9?
 
You can create a formula like this:

//@Recs Due
if DateDiff("d",currentdate,{table.duedate}) > 0 then
1
else
0

Insert a summary on choose Sum as the type.

~Brian
 
I haven't tested this, but in theory it should work.

Create this formula, substituting {Table.DateField} with the date field you're grouping on:

//@DateDiff
If DateDiff("d", {Table.Field}, CurrentDate) > 0 then
1
Else
0;

Place the above formula in your Details section, then you should be able to right click it, create a Summary (subtotal) based on for the group, then drag it into the Group Header.

-dave
 
Grouping on a customer and the numbers are not coming out right. (reason I used running totals to start with). The running toal will not allow me to place it in the group header though. I am getting like 25 in places when I am only seeing 3 records displayed. For some reason this is just not working for me. (even in the group footer it diplays wrong)
 
Running totals only display group results correctly when placed in group footers. If you need to see the results in a group header, you need to be able to use inserted summaries or else you will need to do a subreport.

Please show what your data looks like at the detail level. Are you using any group selection or are you suppressing any detail records? Do you have duplication because you are joining multiple tables?

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top