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

Nth largest of a summarized group

Status
Not open for further replies.

divamom74

Technical User
May 17, 2013
3
US
I am trying to disply the Nth Largest (1) of summarized fields within a group. I have 2 groups, Group 1 is the Client, Group 2 is a date files were imported for that client. I am summarizing the dollars by date (group 2) to determine the largest day for that Client. I need to display the dollars for the largest day only (and perhaps which date it was as well) in the footer for the Client group. Everything I've tried says I can't use a summary field to get the Nth Largest.
 
Create three formulas:

//{@reset} for the Client group header:
whileprintingrecords;
currencyvar maxsum := 0;
datevar dt := date(0,0,0);
stringvar display := "";

//{@maxsum} for the date group header:
whileprintingrecords;
currencyvar maxsum;
datevar dt;
stringvar display:="";
if maxsum < sum({table.amount},{table.date}) then (
maxsum := sum({table.amount},{table.date});
dt := date({table.date})
);
display := totext(dt,"MM/dd/yyyy")+": " + totext(maxsum,2);

//{@displ} for the client group footer:
whileprintingrecords;
stringvar display;

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top