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

maximun function

Status
Not open for further replies.

PauloMongo

Programmer
Jul 16, 2001
80
GB
I have a database that stores transactions from Monday to Friday, I run reports against this, but not always on the same day, I want to bring back all transactions for the last date in the database.

eg. Current Date = 130406
Last Tran Date = 110406.

I use the following formula to work out the last transaction date

maximum({TRANSACTIONS.TRAN_DATE})

I then use another formula to bring back all transactions for the that date

if {TRANSACTIONS.TRAN_DATE} = {@Maximum Date} then
{TRANSACTIONS.TRAN_AMT}

This works fine, however I want to summarise on this field, but this will not let me, any ideas.

Thanks,
 
Waht version of CR are you using? You could go to report->selection formula->GROUP and enter:

{TRANSACTIONS.TRAN_DATE} = maximum({TRANSACTIONS.TRAN_DATE},{table.groupfield})

...assuming you want the maximum per group. Then to do calculations across groups, you would need to insert running totals, since the non-group selected records would still contribute to inserted summaries. So you would insert the rt, choose sum of {transactions.tran_amt}, evaluate for each record, reset on change of group (for a subtotal). Place the running total in the group footer.

If you have CR 9 or above, you could use a command to limit the actual records returned to the report.

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top