Skip to main content
Apricot Results | Creating Variables

This article will go over adding a new variable to an Apricot Results Report using the Variable Editor.

Updated over a year ago

How to Create a New Variable


  1. Click on the Show Document Objects tab in the right most panel and select Add Variable. This opens up the Variable Editor.

  2. Name: Name the variable something descriptive

  3. Type: This will populate automatically after the formula is entered

  4. Description: This is optional; allows you to describe the variable's function

  5. Qualification: Dimension, Measure, or Detail (variables will automatically change to measure if there is an aggregate function)

  6. Formula: Type the formula for the variable into the formula pane

  7. Validate Formula: Tells you if the formula is defined correctly or if there are errors

  8. Cancel: erases any changes made within the last edit

You can use created variables in a formula or within the report in exactly the same way as you use other report objects. They will appear in the Variables folder within the Available Objects window.

When hovering over a variable's name, 3 dots will show next to it. Clicking on those dots will allow you:

  • To edit a variable by choosing Edit.

  • To delete a variable, select Delete. This will permanently delete the variable.

  • To create a copy of a variable, select Duplicate. The copy can be edited and adjusted as needed.
    This is useful when similar variables need to be created many times (very helpful for flattening data).

  • To rename a variable without opening the entire variable editor, select Rename.

Any formula created can be turned into a variable if the formula needs to be used in other formulas/variables.

Notes

Square brackets [ ] should surround data elements. Always place a semicolon (;) between dimensions where referencing multiple data points.

Rounded Parentheses ( ) should surround and group the functions/operators to be performed; everything within the parentheses of a function or operator is related to that action

  • Issues with too many or too few parentheses are common—be sure to count your parentheses to be sure you are aren’t missing any!

  • If your variable doesn’t behave the way you expect, misplaced parentheses are a common culprit. Be sure you have grouped your actions they way you intended.


Formulas are performed following mathematical logic--actions are performed from the inside to the outside. Be sure to remember this as you consider the order of your formulas.

Specific considerations/actions are performed first (and will be towards the middle of a formula) and over-arching actions are performed last (and will be towards the outside of the formula).

Did this answer your question?