IF functions are calculations that produce different results when certain criteria are met. IF functions can examine measures, dimensions, calculations, and other data, such as the current date.
Simple IF functions are always constructed the same way in Analytics, including the punctuation: if( criteria ,result if true ,result if false )
To try a simple version of this, you can start by building upon the employee commission model.
For example, your store's employee commission structure requires employees to meet a specific sales target. To track their performance, open the Employee Team Performance report and remove unnecessary measures like:
- Sales by hour
- Profit by hour
- Total hours
- Basket size
To start, find a midway point in the Sales Totals. For example, if your data shows that some employees have made over $20,000 in sales, but others have made under $2,000, and you want to set your sales target to $5,000, you'll have to create a calculation:
- Click Calculation from the Data header to display Table Calculations.
-
Enter if()
-
In the brackets, search and enter Sales total.
-
After the Total enter a less than symbol (<).
-
Enter 5000 and a comma (,).
-
Next, add a 0 and a comma (,). This is because there would be no commission if the employee has less than $5,000 worth of sales. Therefore, the if true value is 0.
-
Finally, you need to define the value if the employee's sales are less than $5,000, they get a commission. For example, if their commission is 4% of the total sale, you need to enter *0.04. Ensure there is a closing bracket after this.
The final calculation in this model is:
if(${cl_employee_sales_dates.sum_total_no_tax}<5000,0,${cl_employee_sales_dates.sum_total_no_tax}*0.04)
-
Click Save Table Calculations. The report will have a new column titled Calculation 1.
- Optionally, rename the calculation title, for example 4% Commission.
-
Optionally, you can change the number formatting from default to your desired currency.
You can further enhance this report by:
- Adding a column that calculates how close employees are to hitting their target by subtracting actual sales from the sales target.
- Dividing employee sales by the target to determine how close they are, percentage-wise, to hitting the target. We could define multiple tiers of targets (if they hit $5,000, they get 2%, if they hit $10,000, they get 4%, and so on).