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!

second last date

Status
Not open for further replies.

veles

Technical User
Sep 1, 2006
57
CA
Hello,

I have a date field holding dates of activities {S_CASE.ASGN_DT} for clients {S_ORG_EXT.DUNS_NUM}.

I understand to get the latest date showing is to use

{S_CASE.ASGN_DT} = maximum({S_CASE.ASGN_DT},{S_ORG_EXT.DUNS_NUM})

Is there a formula to get the second last date?

Thanks
 
You could insert a group (#2) on the date field. Then insert a maximum on the date field at the date group level. This will allow you to use a group sort. Suppress the group #2 header and footer. Go to report->group sort and select maximum of date and choose TopN instead of 'All' and set TopN to 2. This will return the two most recent dates per duns_num group (#1). If you only want to show the second most recent date per group #1, then go to report->selection formula->GROUP and enter:

{S_CASE.ASGN_DT} <> maximum({S_CASE.ASGN_DT},{S_ORG_EXT.DUNS_NUM})

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top