Using Attributes in Formulas to Identify Cells to Calculate
  • 1 Minute to read
  • Dark
    Light
  • PDF

Using Attributes in Formulas to Identify Cells to Calculate

  • Dark
    Light
  • PDF

Article summary

You can use Attributes within formulas to identify the data cells that should be modified by the formula.

ModelingImages01to50image36AttributeDefined.png

Then define a formula that assumes that freight costs will be higher for products with an Olympics logo on them. In the example below, freight costs per unit are increased by $2 for products with a 2-color Olympic logo on them.

ModelingImages01to50image35FormulawithAttribute.png

If you want to set the year and attribute value just before running the calculation, you could add variables to the Filter Value. Regular dimensions and Attributes can both use variables.

ModelingImages01to50image37FormulawithVariable.png

You can also use variable expressions for the Filter Value. In the following example, the 4th quarter of the year and the first logotype in the Olympics attribute will be calculated with the formula. Regular dimensions and Attributes can both use variable expressions.

ModelingImages01to50image38FormulawithVariableExpression.png

For more information on expressions, see Example Substitution Variable Expressions.

To run the formula, create a calculation that includes a row for the formula to be executed and defines the variables. Then add a row to aggregate the parents affected by the formula, if desired. In the example below, Scenario and Year is a separately defined Scope with variables @Scen@ and @Year@.

ModelingImages01to50image39CalcWithFormulaAttribute.png

Notes:
  • Attributes are supported only in the Filter section of the Formula.
  • You can use attributes with or without the base dimension included in the Filter section of the Formula. When you are using attributes along with the base dimension, both members will be used in filtering the cells for the formula to include in the calculation.

Best Practice

Use attributes in formulas only if needed.


Was this article helpful?