3,050
edits
Changes
no edit summary
The arithmetic expressions relate two operands (value or another expression) to compose a sum, subtraction, multiplication or division.
Syntax: ''<operand/expression> + <operand/expression>''.
'''Examples''': "Taxes" + "Commissions";
Syntax: ''<operand/expression> - <operand/expression>''.
'''Examples''': "Gross Sale" - "Taxes";
Syntax: ''<operand/expression> * <operand/expression>''.
'''Examples''': "Amount" * "Unit Price";
Syntax: ''<operand/expression> / <operand/expression>''.
'''Examples''': "Total Value" / "Amount".
The relational expressions compare two operands (value or another expression) two evaluate if a condition is ''true'' or ''false''. Usually used with decision functions, like the ''IF''.
Syntax: ''<expression> == <expression>''.
'''Examples''': "Unit Price" == "Total Price";
Syntax: ''<expression> != <expression>''.
'''Examples''': "City.City" != 'New York';
Syntax: ''<expression> > <expression>''.
'''Examples''': "Order Date" > '01/01/2011';
Syntax: ''<expression> >= <expression>''.
'''Examples''': IF("Order Date" >= '01/01/2011';"Order Date";0);
Syntax: ''<expression> < <expression>''.
'''Examples''': "Profit" < '0';
Syntax: ''<expression> <= <expression>''.
'''Examples''': IF("Order Date" <= '01/01/2011';"Order Date";0).
Syntax: ''<expression> && <expression>''.
'''Examples''': IF((Gross Sales > '0') && (Seller == 'John Snow');'Sold';'Not Sold'), IF((City!="#null") && (Date<DAY_FROM_TODAY(0));1;0);
Syntax: ''<expression> || <expression>''.
'''Examples''': IF((Gross Sales > '0') || (Sold == 'true');'Sold';'Not Sold'), IF((City!="#null") || (Date<DAY_FROM_TODAY(0));1;0);
Syntax: ''! <expression>''.
'''Examples''': IF(!BETWEEN("Date", '01/01/2013', '31/12/2013');'Not 2013';'2013').
The basic functions are system default functions and implements useful functionalities.
Syntax: ''ABS(<expression>)''. Accept one parameter and process a numeric data type.
'''Examples''': ABS(Gross Sale-Taxes);
Syntax: ''AVG(<expression1>;<expression2>[;<expression3>;...;<expressionN>])''. Accept multiple parameter and process a numeric data type.
Can be used to return the average value of different columns from the same row of a table.
'''Examples''': AVG(Taxes;Commissions;Costs);
Syntax: ''BETWEEN(<expression_to_test>;<expression_bottom_limit>;<expression_top_limit>)''. Need three parameters (of any data type, but
the three must be from the same type) and returns a boolean, ''true'' if value is inside the boundaries and ''false'' if not.
'''Examples''': BETWEEN("Date";'01/01/2013';'31/12/2013'), BETWEEN("Gross Sales";'0';'1000.00');
Syntax: ''IF(<expression_test>;<expression_for_true>;<expression_for_false>)''. Need three parameters, a boolean for test and returns any
data type, provided that both are from the same type. Useful for logic tests where two different executions expressions are
'''Examples''': IF("Branch"=='SOUTH';'South';'Other Branch'), IF("Profit"==0;0;Profit+Taxes);
Syntax: ''LOG(<expression_number>[;<expression_base>])''. Minimum one parameter and maximum two. If just one parameters is given, the
neperian log is returned. If the second parameter is also given, returns the log in the respective base.
'''Examples''': LOG(Profit);
Syntax: ''MAX(<expression_value1>;<expression_value2>)''. Need two value parameters and returns a value data type.
'''Examples''': "Total Value"/MAX("Quantity";"1");
Syntax: ''MIN(<expression_value1>;<expression_value2>)''. Need two value parameters and returns a value data type.
'''Examples''': "Total Value"/MIN("Quantity";"1");
Syntax: ''POW(<expression_number>[;<expression_exponent>])''. Minimum one parameter and maximum two. If the exponent value is not given,
use two (2) by default.
'''Examples''': POW(Value1)+POW(Value1-Value2;3);
Syntax: ''RANDOM(<expression_bottom_limit>;<expression_top_limit>)''. Need two parameters, the bottom and the upper limit of the random
number to be generated.
'''Examples''': RANDOM(0.0;1.0);
Syntax: ''SQRT(<expression>)''. Need one parameters, the value to be calculated.
'''Examples''': SQRT('36').
The date functions are operations that use as parameters and return result of the [[Date|date data type]].
** '''0''': DATE_FIELD_YEAR (Year part);
** '''1''': DATE_FIELD_MONTH (Month part);
Syntax: ''DATE_PART(<expression_date>;<constant>)''. Need two parameters, the first is the reference date and the second the constant
representing the desired part date: 0, 1, 2, 3 or 5 (see above constants list).
'''Examples''': DATE_PART("Order Date";0) - returns the year part of the "Order Date";
Syntax: ''DAY_FROM_TODAY(<expression_number_days>)''. Need one parameter, the number of days to add or subtract.
'''Examples''': DAY_FROM_TODAY(-1) - returns the yesterday date;
Syntax: ''FIRST_DAY_OF(<constant_grouping>;<expression_date>)''. Need two parameters, the first is the constant grouping in which you
want to obtain the first date: 0, 1, 2, 3 or 5 (see constants list) and the second is the anchor base date.
'''Examples''': FIRST_DAY_OF(0;DAY_FROM_TODAY(0)) - first day of year (0) from today (DAY_FROM_TODAY(0)), FIRST_DAY_OF(1;"Order Date") -
first day of month (1) based on the "Order Data";
Syntax: ''FIRST_DAY_OF(<constant_grouping>;<constant_modify_date>;<modify_date_value>)''. Need three parameters, the first is the
constant grouping in which you want to obtain the first date: 0, 1, 2, 3 or 5 (see constants list), the second is the modifier
'''Examples''': FIRST_DAY_OF(1;0;-1) - first day of the current month (1) from last year (0;-1);
Syntax: ''LAST_DAY_OF(<constant_grouping>;<expression_date>)''. Need two parameters, the first is the constant grouping in which you
want to obtain the last date: 0, 1, 2, 3 or 5 (see constants list) and the second is the anchor base date.
'''Examples''': LAST_DAY_OF(0;DAY_FROM_TODAY(0)) - last day of year (0) from today (DAY_FROM_TODAY(0)), LAST_DAY_OF(1;"Order Date") -
last day of month (1) based on the "Order Data";
Syntax: ''LAST_DAY_OF(<constant_grouping>;<constant_modify_date>;<modify_date_value>)''. Need three parameters, the first is the
constant grouping in which you want to obtain the last date: 0, 1, 2, 3 or 5 (see constants list), the second is the modifier
'''Examples''': LAST_DAY_OF(1;0;-1) - last day of the current month (1) from last year (0;-1);
Syntax: ''NEW_DATE(<expression_day>;<expression_month>;<expression_year>)''. Need three parameters, the first is a valid day number (1 to
31), the second for a month (1 to 12) and the third is a year. The date is created from year to day, therefore, the day must be
"Order Date" column;
Syntax: ''NUM_OF_DAYS(<expression_date1>;<expression_date2>)''. Need two date data type parameters.
'''Examples''': NUM_OF_DAYS(FIRST_DAY_OF(0;"Order Date");"Order Date") - returns the number of days between the first day of year based on
column;
Syntax: ''NUM_OF_MONTHS(<expression_date1>;<expression_date2>)''. Need two date data type parameters.
'''Examples''': NUM_OF_MONTHS(FIRST_DAY_OF(0;"Date");"Date") - Return the number of months between the first day of the year of the "Date"
column and the current month of the "Date" column;
Syntax: ''PREVIOUS_DATE(<expression_day>;<expression_month>)''. Need two parameters, the first is the day of month and the second the
month.
'''Examples''': PREVIOUS_DATE(1;4) - return the closest ''01/04'', in other words, until "01/04/current year", returns "01/04/last year",
after that returns "01/04/current year".