Calculations and functions can help us elevate our analysis and save us from a large amount of manual work. We will discuss the differences between the two, some use cases and different types.
The Differences
Calculations utilise existing fields in our dataset. They allow manual input of values and will either create a new field or overwrite an existing field. A function is the type of instruction within a calculation.
Examples
Below is an example of a function. In blue we have our function, with a text explanation in the grey box on the right. The ‘datediff’ function calculates how many days there are between [Order Date] and [Ship Date] which are both fields in the dataset. The function in this case facilitates the calculation of working out the difference between the two dates.
Different Types of Functions
Include calculations such as SUM(), MIN(), MAX() and ROUND(). Particularly useful as they can save a lot of manual calculations.
Ways to manipulate/extrapolate dates. The DATEDIFF() example has already been discussed. Another common date function is TODAY(), which simply returns today’s date.
Manipulating, and extrapolating from strings. Can also be used to combine/separate fields. SPLIT() is particularly useful here.
Allows you to determine if certain conditions are true or not. IF() statements are very commonly used as logical functions, generally returning one value in one field, if another field is equal to a certain value or meets certain conditions.