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

Displaying/Surpressing Groups based on Most Recent Record

Status
Not open for further replies.

skoutr1

Technical User
Aug 9, 2001
22
0
0
US
I have a report grouped by Reference Number (see example below). I want to display any Reference Number groups when the most recent status is "Closed" and is within a given quarter. All statuses need to be displayed even when a date/time is outside the target quarter.

[tt]RefNo:[tab]A219488

Status[tab][tab][tab][tab]DateTime
Open[tab][tab][tab][tab]3/28/2016 8:44:52 AM
Submittal Pending[tab]3/29/2016 11:06:48 AM
Under Review[tab][tab]4/12/2016 1:56:49 PM
Submittal Pending[tab]4/15/2016 10:41:20 AM
Under Review[tab][tab]4/23/2016 12:31:36 PM
Submittal Pending[tab]4/27/2016 1:11:58 PM
Open[tab][tab][tab][tab]4/28/2016 10:25:08 AM
Submittal Pending[tab]4/28/2016 10:25:18 AM
Under Review[tab][tab]6/15/2016 9:49:20 AM
Awaiting Approval[tab]6/16/2016 10:37:18 AM
Closed[tab][tab][tab][tab]6/16/2016 10:37:26 AM
[/tt]
 
The only way you'll be able to do this is to use a Command, which is a SQL Select statement, or a Stored Procedure to get ALL of the data for the report.

What type of database are you connecting to? Can you go to Database>>Show SQL Query and post here the current report query? With that information, I can write a Command for you that will meet your needs.

Also, for more information about how to use Commands, see my blog post here: Also, I will be presenting a session on this topic at the ASUG BI and Analytics Conference next month in New Orleans.

-Dell

DecisionFirst Technologies - Seven-time SAP BusinessObjects Solution Partner of the Year
 
Another method would be to create a SQL expression (syntax depends on CR version) like the following {%maxdt}:

(
select max(`date`)
from table a
where table.`refno`=a.`refno`
)

This will return the most recent dater per refno. Then create a formula {@maxdtclosed} like this:

if {table.date}={%maxdt} and
{table.status}="Closed" then 1

Then go to report->selection formula->group and enter:

sum({@maxdtclosed}, {table.refno})>0

Note that other data is still in the report, though not visible, so you should use running totals to capture any summaries instead of the more customary inserted summaries.

-lb
 
Thanks for the input. I was able to get it to work using a Command.

-Rod
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top