Suppose you’re totaling licensee fee revenue for a county, and you want totals for each city, for each different fee category. First you create an index on the city and fee category:

index on CITY + FEE_CAT tag CITY_FEE

Then you use SET FIELDS to create a calculated key field based on the two fields on which you can TOTAL:

set fields to CITY_FEE = CITY + FEE_CAT

set fields to CITY, FEE_CAT, LIC_PAID

total on CITY_FEE to CITY_PAID

Even though the composite field, which will appear in the result table, has the city and fee category, the city and fee category fields are included in the field list so that they will appear in the result table as separate fields. The field containing the license fee paid is also included in the field list, otherwise there would be nothing to total.