[Dataperf] Totals per year

Tim Rude timrude at hotmail.com
Wed Aug 22 21:26:08 CEST 2018


2 methods come to mind:

(1) Add a hidden G9999::H (not ::C) field to your sales panel which 
holds only the year. Your formula on this field (auto-calculated on any 
change) will be 'year[PxFx]' where PxFx is the field number for your 
sales date.

(Note: If you already have data in this panel, you'll need to export it 
out, empty the panel, add the new field with the formula, and then 
import the panel data back in.)

Then you can do a 2-level report based on this field to sort your sales 
by year, using a report variable that's reset to 0 in each 2-level 
header, increased by the sale amount in the report body, and outputs the 
total in the 2-level footer.

--- OR ---

(2) To do it without modifying the database structure: Create a report 
that goes through the sales panel records in date order. Designate a 
report variable (say RV1) to hold the year being processed. Designate 
another report variable (say RV2) to hold the total for each year. Start 
the report with RV1=0 and RV2=0. When processing each entry in the 
report body, have a formula check to see if year[PxFx] = rv1. If it 
does, add the sale for this record to RV2 and continue. Otherwise, use a 
virtual subreport linked to only the current record to print the total 
for RV2, reset RV2 back to 0, update RV1 to the new year, and print the 
new year heading.

Tim Rude

To me, the first method is better (even though it means tweaking the 
structure) because it's more straight-forward. But the second method is 
also workable, if slightly more convoluted.

On 8/22/2018 12:19 PM, Michael Iannantuoni wrote:
> Although I still use DataPerfect regularly, I am using databases I 
> created a while ago so am rusty on doing new things!
>
> I am trying to do something which I think should be very easy but am 
> stumped.
>
> I have a sales panel containing an item description and a sales date.
>
> I wish to write a report that will give me total sales for each year.
>
> Any help greatly appreciated.
>
> Michael
>
>
> _______________________________________________
> Dataperf mailing list
> Dataperf at dataperfect.nl
> http://lists.dataperfect.nl/cgi-bin/mailman/listinfo/dataperf



More information about the Dataperf mailing list