Basic math functions include:
Addition and subtraction using + & -
Multiplication and division using * & /
Percent and exponent using % & ^
More advanced functions can be used such as:SIN,COS,TAN.
These can be used in conjunction with other data sets as shown in the example below. In this example, data is taken from Office Area, Vivarium Area, Communal Area and Warehousing Area. These figures are then added together to produce a new figure as the output.
office_area_number+vivarium_area_number+communal_area_number+warehousing_area_number
Comparison operators are symbols that let you compare two objects and make a decision based on the result, these include:
Less than or greater than using < & >
Greater or equal to and Less or equal to using >= & <=
Equal to or not equal to using = & !=
By using the IF & AND operators the example below shows how an expression utilising comparison operators would work. In this example, the expression checks if the Cost Number is greater than 0 and the Headcount Number is greater than 0, then divides Cost by Headcount.
IF (cost_number > 0 AND headcount_number > 0, (cost_number / headcount_number), 0)
Logical operators are used to connect two or more expressions and can check the values of each before proceeding. There are three common logic operators used, these are: IF, AND & OR
To begin every logic function, start with the IF operator. The IF operator will check if a statement is True. This can be combined with the AND operator, to check if both statements are True. If combined with the OR operator either statement can be true.
Alongside the basic math functions, numeric operators can be used to complete more advanced formulas. These operators include:
MIN will determine the minimum value.
MAX will determine the maximum value.
AVG will determine the average of all the figures inputted.
SUM will calculate the sum of all the figures inputted.
COUNT will calculate how many entries are within a data set.
ROUND will round a number to a specified number of digits, ROUNDUP or ROUNDDOWN could also be used in specific use cases.
These can be used to create advanced expressions and utilise all the data captured. In the example below SUM has been used to calculate the total occupant area. Then ROUND has been used with,2 to round to two decimal places.
ROUND (SUM(PLUCK('total_occupant_area_expression')),2)
Using the collection operator can receive data from another data set or even another expression. Below is an example of using the PLUCK operator.
In this example, the data from Headcount Number has been brought into this expression. The referenced tag, in this example 'headcount_number' must be a data set or expression within the child location type. Alternatively, if the reference is 'id' it will return all of the data within a collection.
SUM (PLUCK('headcount _number'))
COUNT (PLUCK('id'))