## How to Create a New Variable

Click on the

**Show Document Objects tab**in the right most panel and select**Add Variable**. This opens up the**Variable Editor.****Name**: Name the variable something descriptive**Type**: This will populate automatically after the formula is entered**Description**: This is optional; allows you to describe the variable's function**Qualification**: Dimension, Measure, or Detail (variables will automatically change to measure if there is an aggregate function)**Formula**: Type the formula for the variable into the formula pane**Validate Formula**: Tells you if the formula is defined correctly or if there are errors**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).