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!

Minimum function

Status
Not open for further replies.
Mar 19, 2003
57
0
0
US
Crystal Reports 9

Need help creating a Minimum (MIN) formula based on the results from a Summary (SUM) formula. Below is the Summary formula:

sum({agentstats.acdgrpprimtalktime}, {agentcnfg.agent_id}) + sum({agentstats.acdgrpovfltalktime}, {agentcnfg.agent_id})

The summary formula is on the Group Footer section in the report. The selection of records is on a date field. I need a a formula that will high light the lowest value from the Summary formula.

For example, lets say the data looked like this:

Agent_ID Summary Formula

Jane Doe 200
Sara Harp 100
Adam Park 500

Again, I need the Minimum formula to high light the lowest value based on the Summary formula. In this case, Sara Harp has the lowest value.

 
Hi question911

You are trying to create a Summary of a Summary which CR has a hard time doing.

Have you tried doing a TopN/BottomN sort - bringing the lowest value to the top and then highlighting the first group that appears?

I hope this helps

paulmarr

 
You could save your report under another name and import it as a subreport in the report header of your original report. In the subreport, create the following formula:

//{@findminsum} to be placed in the group footer:
whileprintingrecords;
shared numbervar minsum;

if groupnumber = 1 or
sum({agentstats.acdgrpprimtalktime},{agentcnfg.agent_id}) + sum({agentstats.acdgrpovfltalktime},{agentcnfg.agent_id}) <= minsum then
minsum := sum({agentstats.acdgrpprimtalktime},{agentcnfg.agent_id}) + sum({agentstats.acdgrpovfltalktime},{agentcnfg.agent_id}) else
minsum := minsum;

Suppress all subreport sections.

Then in the section expert->group footer->color->background->x+2 ->enter:

whileprintingrecords;
shared numbervar minsum;

if sum({agentstats.acdgrpprimtalktime},{agentcnfg.agent_id}) + sum({agentstats.acdgrpovfltalktime},{agentcnfg.agent_id}) = minsum then cryellow else crnocolor

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top