Modifying Calculations using If

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Modify calculations using If

If in Modifying Calculations

The If() function is useful in extending the functionality and flexibility of calculations in reports so that they behave more dynamically.

The syntax for using the If() function to modify the behavior of calculations is:

  • =If([object name] = "true value" ; [measure] behavior A ; [measure] behavior B)

    Or

  • =If [object name] = "true value" Then [measure] behavior A Else [measure] behavior B

In other words, if the value returned by an object is equal to what is specified in quotes, then the calculation should behave in a certain manner, otherwise the values should be calculated in a different manner.

See the following video to learn more about creating a query.

Syntax of the If Function

This syntax is based on the If...Then...Else logic and the percentage rates by which each state is supposed to grow.

Some considerations regarding this syntax are:

  • When you compare a single state, you place the = sign before the state value, but when two (or more) states are used, you need the InList operator.
  • The syntax requires that when multiple values (states) are listed, all the values must appear in parentheses, and each individual value must be in quotes as well as separated from the other values by a semicolon.

Log in to track your progress & complete quizzes