ENGAGE HELP CENTER
Example 4: Percentage of measurements exceeding the threshold in the last x days
This guide will demonstrate an example of Calculated answers applied.
Percentage of measurements over the norm in the last x days

This example demonstrates how to calculate the percentage of measurement submissions exceeding a defined threshold over a specific period (e.g., 14 days). We'll build the formula step by step, incorporating Constants, Map and Length operations, and basic arithmetic calculations like Division and Multiplication.
The goal is to determine when a certain percentage of measurements surpasses a predefined threshold, such as 3, within the last 14 days. Here's how to construct the formula:
Step 1: Create a new Constant for measurements above the threshold.

- Add a Sum operation to the constant.
- Remove the second addend in the Sum operation by selecting it and clicking the delete (bin) icon, as only one addend is needed.
- For the remaining addend, add a Map operation to evaluate whether submissions exceed the threshold.
- Remove the second element in the Map operation (keep only one).
- Within the Map operation, add a Linked question operation and configure it as follows:
Activity: Select the activity containing the measurement question.
Question: Choose the specific measurement question (e.g., LDL cholesterol).
Position: Enter [-2w:] to reference submissions from the last 14 days.
- Complete the Map operation by defining the comparison criteria:
Comparison: Select the "greater than" (>) symbol.
Value: Set the threshold (e.g., 3).
Step 2: Create a constant for all submissions.

- Add a new constant and choose the Length operation.
- Remove the second element, as only one is required.
- For the remaining element, add a Linked Question operation and configure it with the same parameters as in Step 1:
Activity: Select the activity containing the measurement question.
Question: Choose the measurement question (e.g., LDL cholesterol).
Position: Enter [-2w:] to reference submissions from the last 14 days.
Step 3: Construct the main formula.

To calculate the percentage of measurements exceeding the threshold:

1. Add a Multiplication operation in the Calculation field.
2. For the first factor of the multiplication, add a Division operation and configure it as follows:
Dividend: Add a Constant/Question operation. Select the constant created in Step 1 (measurements >3).
Divisor: Add a Constant/Question operation. Select the constant created in Step 2 (all submissions).

3. For the second factor of the multiplication, enter 100 to convert the result into a percentage.
Final formula output
This formula will calculate a decimal number (e.g., 75.2345566666; 81.566666666) representing the percentage proportion of submissions exceeding the threshold (3) over the past 14 days.

Additional enhancements
You can extend this setup by creating a Response alert to notify you when the percentage crosses a certain threshold (e.g., 80%).

Learn more about Response alerts.
We use cookies in order to secure and improve the Longenesis web page functionality, as well as to optimize your experience within this page.
Please see our Privacy policy for more information on how we use the information about your use of our web page. By continuing to use this web page you agree to our Privacy Policy.