A computed value allows you to input formulas that include other form fields on your Worksheet. That means you can automatically calculate averages, sums, and so on, and of course pipe these into Metrics as well.
Let’s take a look at one in action...
I’d like to know how a given client feels on average about the topic on this Worksheet. I’ve already got three questions that address that opinion, so I will take the average of these to get the person’s general feeling.
Create Fields First
Step 1 is to create the form-based fields you’ll use in the computed value. Basically, the system has to know what it’s supposed to add/subtract/multiply/divide. It’s like baking: you can’t start with the step that says “mix all the ingredients into the bowl” without knowing what those ingredients are.
Add a Computed Value
Next, create a computed value. Use the Form Items button on the toolbar, the same way you did for the other form fields.
The name should be something you’d use as a title in a spreadsheet column. The formula, though, is where it gets really juicy.
See the options for values to include in this formula, those clickable green links? They are all from the same Worksheet I'm working on. That’s why it’s so important to create these fields in advance.
Now, just click on any of those to add it to your formula.
Since I want the average, I need to add these three fields together, then divide by three. CA knows PEMDAS, so using parentheses makes sure that the adding gets done before the dividing.
I don’t want my client to see this as a question, because I only want to use it to create a Metric for her (another reason you may not want clients to see the computed value is if you’re just keeping this number for yourself. You can always run a report on just this field by using the Data Lab’s Single Field reporting function).
This hidden field means that the Worksheet looks exactly the same to the client as it did before.
Let’s build a Metric that pipes in the data from this computed value field.
And voila! You’ve got magically appearing Metric data from a question your client didn’t even know she answered. By the same token, it’s often nice to have a computed value show right within the Worksheet. That value will magically update itself as your client fills out the other parts of the worksheet that are part of the formula. This can be nice for something like a total score that grows as your client answers the questions. Hidden or displayed, whichever way makes the most sense.
Which functions can a CoachAccountable computed value do?
Pretty much any valid mathematical expression of arithmetic will work! This includes:
Computed Value Formula Errors
And if the formula as you’ve typed it is not valid (perhaps some parentheses don’t match up quite right or you’ve got a typo in your input names) the system will let you know right away so you can make corrections.