If function
The If() function returns the result of a conditional statement. It allows you to specify conditional logic within the column(s) of macro actions defined to update or insert data.
Only allows up to 8 levels of nested If() statements. This is a SQL Server restriction.
Use case
You can use the If function to return the appropriate classification of a Pareto score for a product. The function is:
IF (Pareto.Score > 0.8, ‘A', IF (Pareto.Score > 0.6, ‘B', IF (Pareto.Score > 0.4, 'C', IF (Pareto.Score > 0.2, 'E’, 'U’))))
The results from the following sample data are:
| Product | Pareto Score | Result |
|---|---|---|
| 1 | .9 | A |
| 2 | .75 | B |
| 3 | .7 | B |
| 4 |
.65 |
B |
| 5 | .55 | C |
| 6 | .45 | C |
| 7 | .3 | E |
| 8 | .1 | U |
For a use case with greater detail, see Classify locations by volume of orders shipped.
Last modified: Friday May 12, 2023