This article will cover how to use Calculated Fields to create a report that shows clients enrolled in a service on a specified day.
How to create a report that answers the question: Which clients received a service on this day?
- Create a New Visualization
- Select the Service_Enrollments Dataset
- Drag and drop the following fields into the Grid Data section under Rows
- Service Name
- Person Name
- Provider Name
- Service Start Date
- Service End Date
- Add a new Calculated Field by selecting the + Icon in the Fields List, then selecting Calculated Field
- Name the field "Date Field", then add the following formula. You are able to change this date to any date that you wish to report on. In this example, we are wanting to report on April 14, 2022.
-
date(2022,04,14)
-
- Add a another new Calculated Field by selecting the + Icon in the Fields List, then selecting Calculated Field
- Name the field "Point in Time", then add the following formula:
- if(isempty([service_end_date]), if(and([service_start_date] < [Date Field] + 1,(today() > [Date Field] - 1)),"True","False"), if(and([service_start_date] < [Date Field] + 1,([service_end_date] > [Date Field] - 1)),"True","False"))
- Add your new "Point in Time" field as a visualization filter, and select to filter by "True"
- Save the report by selecting the checkmark icon in the upper right-hand corner.
Note: You can adjust the date that you wish to filter by at any point in time. To do so, select the three ellipses on the calculated field, Date Field, then select Edit. You can then change the date.
Some other Point In Time Calculated Fields:
Scenarios:
- Started in the Reporting Period
- AND(Start Date >= [Start of Reporting Period], Start Date <= [End of Reporting Period])
- Ended in the Reporting Period
- AND(End Date >= [Start of Reporting Period], End Date <= [End of Reporting Period)
- Started before beginning of the Reporting Period & Ended after the reporting period
- AND(Start Date < [Start of Reporting Period], End Date > [End of Reporting Period])
- Started before beginning of the Reporting Period, No End Date
- AND(ISBLANK(End Date), Start Date <= [Start of Reporting Period])
Note: You will need to create calculated fields for 'Start of Reporting Period' and 'End of Reporting Period'. To do so, determine what these dates will be for your reporting needs, and create a calculated field containing a date function: date().
So, depending on how you enter your data you'll need to evaluate if the above scenarios cover all potential options for what you define as a service enrollment being offered in a point in time.
From here, you can choose as many of the above scenarios as you want and combine them into a formula IF(OR([insert all the and statements you want here]),"In Reporting Period", "Not in Reporting Period").
An example of all of them put together would be:
IF(OR(AND(Start Date >= [Start of Reporting Period], Start Date <= [End of Reporting Period]), AND(End Date >= [Start of Reporting Period], End Date <= [End of Reporting Period), AND(Start Date < [Start of Reporting Period], End Date > [End of Reporting Period]), AND(ISBLANK(End Date), Start Date <= [Start of Reporting Period])), "In Reporting Period", "Not in Reporting Period")
Note: < means before and > mean after