Use formulas

The formulas in SendinBlue are used to calculate different data using your contacts' different attributes. You can enter these formulas by going to the Settings tab, then Contact Attributes & CRM.  Apply the formulas under "Calculated Values" or Global Calculated Values. There are three basic functions COUNT, SUM and IF.

For COUNT and SUM :

COUNT[ A , B , C , D ] and COUNT[ A ] This formula is used for counting specific data. SUM[ A , B , C , D ] and SUM[ A ] This formula is used for calculating a total. A is mandatory ; B, C and D are optional A = value to compute ; can be [ORDER_NO] (for COUNT formula) or [TOTAL_ORDER] (for SUM formula) B = condition1 C = function sign D = condition2 For Example: 1) If you want to calculate the total orders made on the past 30 days by client X, the formula would be: SUM[ORDER_VALUE,ORDER_DATE,>,NOW(-30)] Which means SUM[ A (ORDER_VALUE), B (ORDER_DATE), C (>) , D (NOW(-30))] 2) If you want to calculate the number of order made by client X, the formula would be: COUNT[ORDER_ID]

For IF :

IF {A , B , C , D} and IF {A , B , C , D , E} This formula is used for making attribute conditions. A, B, C and D are mandatory; E is optional (is the ELSE condition) A = value to return , can be a fixed value or a dynamic value. For instance: A = STATIC(1) if we want to put a static value like 1 or A = ORDER_DATE if the value that is returned is a attribute value. B, C and D are same as for COUNT and SUM. E = else value to return. Now lets say we want to find the subscriber's whose family household is bigger or less than three members, you would use the formula: {IF,NUM_HOUSEHOLD,>=,3}{Small Family}//{Big Family} Which means: {IF, A (NUM_HOUSEHOLD), B (>=/ is less than), C (3)}{ D (Small Family)}//{ E (Big Family)}

TRANSACTIONAL COMPUTATION (calculate per user)

The formulas given below work only for the transactional attributes. Examples of such attributes are orders, etc. Such attributes can be only found on the user detail page. The calculations here are restricted to single user level only.
1. Count All order number COUNT[ORDER_NUM] 2. Sum all order value if order number is greater than 100 else sum amount SUM[ORDER_VALUE,ORDER_NUM,>100,ORDER_AMOUNT]

FOR RECURRING DATE COMPUTATION (calculate per user)

The formulas given below work only for the attributes with DATE type. For example, this formula can be used to send trigger email with birthday / wedding anniversary wishes etc.. automatically. How does it work ?
First of all you should have an attribute which will contain Date Of birth of your contacts (in our example let's define the attributea DOB) and then create a new formula using ANNIVERSARY[DOB] (Just put the attribute name in square brackets and get the calculation of the anniversary date). Example: If DOB of one contact is: 23/01/1985 then formula will return 23/01/2013 (2013 is our current year). Now, in trigger email we should just select from the dropdown list (in step 3) the name of our formula and set it between 0 days before today and 0 days before today.

FOR GLOBAL COMPUTATION (make calculation on complete DB)

The formulas given below work only for the global attributes. Examples of such attributes are blacklisted users, readers, reads, clickers, clicks, etc.
1. Count all Blacklisted Users COUNT[BLACKLISTED,BLACKLISTED,<,NOW()] This formula is used to calculate all the blacklisted users until now.
2. Count all blacklisted users before 30 days COUNT[BLACKLISTED,BLACKLISTED,<,NOW(-30)] This formula is used to calculate all the blacklisted users before 30 days. Just change the number 30 to alter the number of days.
3. Count soft bounces till today COUNT[BOUNCES,SOFT,<,NOW()] This formula is used to calculate all the soft bounces. Just put the number in the round brackets to calculate the bounces before specific number of days. NOW (-45), etc
4. Count hard bounces till today COUNT[BOUNCES,HARD,<,NOW()] This formula is used to calculate all the hard bounces. Just put the number in the round brackets to calculate the bounces before specific number of days. NOW (-55), etc
5. Count Readers(unique reads) till today COUNT[READERS,READERS,<,NOW()] This formula is used to calculate all the number of total readers. Just put the number in the round brackets to calculate readers before the specific number of days. NOW (-5), etc
6. Count Total Reads till today COUNT[READS,READS,<,NOW()] This formula is used to calculate all the number of total reads. Just put the number in the round brackets to calculate reads before the specific number of days. NOW (-15), etc
7. Count Clickers(unique clicks) till today COUNT[CLICKERS,CLICKERS,<,NOW()] This formula is used to calculate all the number of total clickers. Just put the number in the round brackets to calculate clickers before the specific number of days. NOW (-95), etc
8. Count Total Clicks till today COUNT[CLICKS,CLICKS,<,NOW()] This formula is used to calculate all the number of total clicks. Just put the number in the round brackets to calculate clicks before the specific number of days. NOW (-65), etc