Counts Report
Counts Reports are reports that give you the count of "how many of these things exist". Notice this is different than getting Totals on numeric fields. The idea is to increment a counter once for every record that matches your criteria. This is a very useful tool in information management.
There are several methods to count records. Every Abacus report lists the number of found records at the end of the report. And in the Query Manager you can get a count of all records that match a query. Below are special features available in columnar reports.
Group counts with no field definitions
The first and easiest technique is to simply create a columnar report with no fields, but group on the field you want to count. If a columnar report has NO fields selected, it will produce a special format that lists each group and the number of records in that group.
Just remember that the data must be indexed on the field you want to group by (so all records that fit that group are in order together in the list).
Example: How many Trials or Depositions are on calendar this year?
An events report grouped on EVENTS->WHAT but with no fields will list each What code encountered and give a count for how many events have that code. So you can use a query to filter the report for "events this year" and quickly see counts for each code. Just scan the list for trials and depositions to see how many there are. If you want to show ONLY those two codes, just add that criteria to your query. This report would use the index called WHAT, which sorts the data by What + >When.
If you add more than one group to the report it will give counts for each subgroup under each group. So if you add a group for EVENTS > WHEN it will give you the instances of each What code for each date.
Another example: How many Matters do I have for each Type of Law?
Since there is a standard index on CaseCode:
-
Create a Matters Column report.
-
Select Index from the menu and select CaseCode.
-
Select Other > Groups and group on CaseCode.
That's it! Since you didn't add any field columns, this report will list each CaseCode that appears in a matter record, and print the number of matters that have that code.
Once you understand how things work, this report is a very quick way to get valuable information out of your database, but it is a "hard-coded" layout and lacks the ability to reformat the display.
Special Column Definitions
The second and slightly more complex type of Counts Report can have several different columns counting different things for each record. You can add this technique to existing reports and maintain all your formatting control. Though this is not dependent on Indexes and Groups as in the previous example, the report is usually set as a "Summary" report that does not print each record. Only the Grand totals (at the end of the report) and any Group totals are printed in a Summary report. The Counts we’re looking for will appear in the Totals display.
This method uses the if(,,) function to create special columns. Its structure is as follows:
if( <Field or expression you are testing>, <Result to return if test is true>, <Else If the result is not true return this>)
Example: How many Appointments are on calendar?
Column expression: if(EVENTS->WHAT = "APPT", 1, 0)
In this example the What field in the Events database is being checked to see if the code is equal to APPT. If it is, it will return the value 1. If not it returns 0. We will simply total on this column, thus adding 1 to the total for each record that passes the test and thereby getting our count of how many appointments are in this data set!
To set up the report:
-
Add any field and edit it (the field isn't important; this just adds the column so we can edit it and enter a new expression).
-
In the Column Properties Edit window replace the expression with your if(,,) expression. Always make the second and third elements "1,0". You just need to specify the logical test in the first element to identify what you want to count. You probably want to change the column head at this time.
-
Ensure that the Total this field check box is checked.
-
Repeat as necessary for each column desired.
-
Select Format > Page Layout and click Advanced.
-
Ensure the Summary only check box is checked.
The totals at the end of the report will show your count in each special column you've defined.
Of course the best implementation of this technique will be with your own user-defined fields. If you add a field to the matters database called CaseValue to contain the dollar value of that case, add this column definition to a report:
if(! empty(CaseValue), 1, 0)
you get a count of how many matters have an established value.