Formula operators
The available operators include:
and
Returns
truewhen both conditions aretrue, otherwise returnsfalse.Example
(amount > fee) and (amount > net amount) = true
Not available for row-level security (RLS) formulas.
if…then…else
Conditional operator. Allows for multiple clauses.
Example
if (amount > 500) then 'large' else 'small'
ifnull
Returns the first value if it is not
null, otherwise returns the second value.Example
ifnull (amount, 0)
in
Takes a column name and a list of values. It checks each column value against the list of values in the formula, and returns
trueif the column value matches one of the values in the formula.Example
donor address state in { 'texas' , 'california' }
isnull
Returns
trueif the value isnull(not 0, but unknown).Example
isnull (fee)
not
Returns
trueif the condition isfalse, otherwise returnsfalse.Example
not (amount > net amount) = false
not in
Takes a column name and a list of values. It checks each column value against the list of values in the formula, and returns
trueif the column value does not match any of the values in the formula.Example
donor address state not in { 'texas' , 'california' }
or
Returns
truewhen either condition istrue, otherwise returnsfalse.Example
(amount = net amount) or (amount > fee) = true
Calculate the conditional sum
Using a conditional sum is a great way to isolate specific data points, such as viewing total giving amounts for all successful gifts.
These formulas generally follow this syntax: if (some condition) then (measure) else 0. You can also utilize a sum_if formula. This approach allows you to limit your search results effectively without needing to add a formal column filter. For example: if ( is successful ) then amount else 0 (meaning, if the gift was successful).
The following example demonstrates how to determine what the total giving amount would be if the giving transactions that failed actually didn't fail.
Create the following formula in the Formula Builder and name it "Is Successful."
if ( is successful ) then amount else 0This formula will provide you with the dollar amount of successful gifts.
You can then create another formula that looks like this and name it "Is Transaction Failed."
if ( is transaction failed ) then amount else 0And this formula will provide you with the dollar amount of transactions that failed.
Using nested formulas, you can combine these two formulas. For example:
f1 = Is Successful + Is Transaction failed
Now, you can search using the
f1formula to find out the giving amount you would have if transactions hadn't failed.
