# Math Operations through Document Coding Doc Auto Team
• Updated

## Order of Operations

It is possible to do certain math operations using coding functions in Athennian.  There’s no limit to the number of operations specified, but the order of operations must adhere to BEDMAS/PEMDAS structure, and use the appropriate mathematical symbol(s). This may require additional parentheses inserted into the code to capture the correct order of operations. Common uses of math operations include, but are not limited to, share calculations, or residency requirements (percentage of directors).

Brackets / Parentheses

( )

Exponents*

Division

/

Multiplication

*

+

Subtraction

-

*This is not used within Athennian, and is only presented for reference to the mathematical order of operations.

## Using Math with the Count Function

A count function may be used with math operations to perform the calculation(s) specified. Please see examples in the Count with Math Operations section below.

`{(collectionVariable | count)+(numerical value)}`

### Subtraction

`{(collectionVariable | count)-(numerical value)}`

### Multiplication

`{(collectionVariable | count)*(numerical value)}`

### Division

`{(collectionVariable | count)/(numerical value)}`

## Example: Director Residency

 Sample Dataset Directors: George Bluth (United States) - confirmedLucille Bluth (United States) - confirmedMichael Bluth (Canada) - confirmedLucille Austero (Switzerland) - inactiveGeorge Oscar Bluth (Canada) - outgoing Lindsay Bluth (France) - incomingBuster Bluth (United States) - confirmed

### Complex Count & Math Operations

 Math Operations {((directors | status:'confirmed' | filter:'taxCountry':'Canada' | count)/(directors | status:'confirmed' | count))*100}% Count the number of confirmed Canadian directors  Count the total number of confirmed directors Divide (1) by (3)[1/4 = 0.25] Multiply the results of (4) by 100 for a percentage of Canadian directors - [0.25*100 = 25] Calculate the percentage of Canadian directors by dividing the number of Canadian confirmed directors by the total number of confirmed directors, and multiplying by 100. 25%
<% if (previousArticle || nextArticle) { %>
<% if (previousArticle) { %>
<% if (previousTitle) { %>

#### <%= previousTitle %>

<% } %> <%= previousArticle.title %>
<% } %> <% if (nextArticle) { %>
<% if (nextTitle) { %>

#### <%= nextTitle %>

<% } %> <%= nextArticle.title %>
<% } %>
<% } %>
<% if (items.length > 1) { %>