A person's length of consecutive giving can be queried upon using the special system join of Sequential Value Groups. This join allows for the identification of a data point (such as a gift's year) that can then be used to count the number of times that it appears consecutively (such as 2016, 2017, 2018, 2019, 2020), as well as the minimum and maximum range of the consecutive span (such as 2016 and 2020).
For example, an institution might want to query on donors who have given consecutively for at least 5 years, displaying the number of consecutive years given as well as the start and end date for the range. This type of query can be configured in two primary steps:
- Adding a subquery filter based on consecutive giving
- Adding a subquery export that returns the details of the consecutive giving
Ultimately, the output of this type of query will resemble this example:
The first step to identifying donors who have given consecutively for at least 5 years is to establish which data point will be looked at, sequentially. In this example, the data point to be counted sequentially is the year of the gift.
To create and customize this join:
- Add a Subquery Filter.
- Name the join something that is user-friendly, such as "5 or More Years of Consecutive Giving."
- Leave the Aggregate as Exists.
- Click Join to add a new join to this subquery part.
- In the dialog box, scroll down under the System header and select Sequential Value Groups.
- The next step is to determine which data element should be used for this sequential value join. After clicking Continue, an export must be added. This export becomes the item that Slate will look at to determine if the values are consecutive.
- Because in this example a gift's year is the item being counted sequentially, a join must be added to the Gift table in order to add return the date of the gift. Select Join and choose Gifts.
- Add the export for Gift Date.
- In its standard formatting, the Gift Date export will return a relatively unique value (date + time). To count the sequential years of giving, this export needs to be formatted in a way that only returns the elements to be counted consecutively - in this case, only the year element should be returned. Double Click the Gifts Date export and change the Format Type to "Date."
- Enter "yyyy" for the Format Mask and click Save.
- Click Save on the Sequential Value Groups part.
- With the join added, insert filters as appropriate. Click Filter and select one of the filters from the Sequential Value Groups section - such as Count.
- Configure the Count setting to be >= 5. Click Save.
- Save the subquery filter.
Once the number of records has been appropriately filtered, the next step is to show the details about the years of consecutive giving as part of a subquery export. To configure the export to return the count of the consecutive year of giving, the first year in the series, and the most recent year in the series, follow the steps below:
- Add a Subquery Export.
- Repeat the steps outlined above to join in a Sequential Value Group that references a gift's year. This ensures the exports will be displaying the same data as the overall filter criteria for the query.
- With the join added, select which exports to include. Count, Min, and Max are available as exportable elements for the series.
- These exports can be arranged and literals can be added to provide context to the numbers that will be returned:
- Provide a name to the subquery export part and click Save.