4

# Tip of the Day - use formulate to calculate percentages of some elements

## Our video of the day looks at a way to calculate percentages of elements

A question came up from a client on how to calculate the percentage of two elements in a dimension from the total of this dimension.

The answer is actually quite simple:

1. Create an aggregate of the two elements.
2. Divide by an aggregate of all the elements in the dimension.

Lets do it together:

1. Create a new formulate, calculation, and select the relevant model.
2. Add an Aggregate element, and select the desired elements from the dimension.
3. Divide by a second aggregation of all the elements in the dimension.

Notice that the context of this calculation is in the dimension – so the calculation behaves like another element in the dimension.

If you want it to be a measure – in the aggregates select a data point and change the context to measures.

See the attached video:

You can find the formulate and examples in the Explore Server

Let us know how you like these small tips below