Configuring Expression Columns in Bold BI Dashboard Designer

An expression column is used to create an expression which is a combination of data columns, operators and built-in functions. This expression column will act as a calculated measure that can be configured to widget like other normal numeric columns as a quantitative measure.

Adding an expression column

An expression field can be added by clicking Expression menu in the tool bar of the data design view.

Expression icon

Click Add in the Query Expressions window to add a new expression column.

Expression wizard

Enter a suitable name for the expression in the Name text area. By default, it will be Expression1.

Enter the expression that you like to define in the Expression text area.

Add expression

The syntax for defining a simple expression is,

{function name(}[columnname]{operator[columnname]…}

Where, content within curly braces is optional.

Some expressions for reference:

1) YEAR([Order Date]) – To compute year of order date.

2) COUNTD([EmployeeID]) – To compute distinct count of employees.

3) [Freight]+100 – To compute the total with 100 added to Freight.

Following built-in functions are supported in Expression Designer.

Category Functions Syntax & Descriptions
Numbers ABS
    Syntax:</br> ABS(numeric_expression)</br> Description:</br> Returns the absolute value of the given expression.</br>
Numbers ACOS
    Syntax:</br> ACOS(numeric_expression)</br> Description:</br> Returns the inverse cosine (also known as arccosine) of the given numeric expression.</br>
Numbers ASIN
    Syntax:</br> ASIN(numeric_expression)</br> Description:</br> Returns the inverse sine (also known as arcsine) of the given numeric expression.</br>
Numbers ATAN
    Syntax:</br> ATAN(numeric_expression)</br> Description:</br> Returns the inverse tangent (also known as arctangent) of the given numeric expression.</br>
Numbers CEIL
    Syntax:</br> CEIL(numeric_expression)</br> Description:</br> Returns the smallest integer value that is greater than or equal to the given numeric expression.</br>
Numbers COS
    Syntax:</br> COS(numeric_expression)</br> Description:</br> Returns the cosine of the angle specified in radians, in the given expression.</br>
Numbers COT
    Syntax:</br> COT(numeric_expression)</br> Description:</br> Returns the cotangent of the angle specified in radians, in the given expression.</br>
Numbers DEGREES
    Syntax:</br> DEGREES(numeric_expression)</br> Description:</br> Returns the angle in degrees for the one specified in radians, in the given numeric expression. </br>
Numbers EXP
    Syntax:</br> EXP(numeric_expression)</br> Description:</br> Returns the exponential value of the given expression. </br>
Numbers FLOOR
    Syntax:</br> FLOOR(numeric_expression)</br> Description:</br> Returns the largest integer value that is less than or equal to the given numeric expression. </br>
Numbers MOD
    Syntax:</br> MOD(numeric_expression, numeric_expression)</br> Description:</br> Returns the reminder of the first numeric expression divided by second numeric expression. </br>
Numbers LOG
    Syntax:</br> LOG(numeric_expression)</br> Description:</br> Returns the logarithm of the given expression to the specified base. </br>
Numbers PI
    Syntax:</br> PI()</br> Description:</br> Returns the constant value of PI.</br>
Numbers POWER
    Syntax:</br> POWER(expression1, expression2)</br> Description:</br> Returns the value of the given expression (expression1) to the specified power (expression2).</br>
Numbers RADIANS
    Syntax:</br> ROUND(numeric_expression)</br> Description:</br> Returns a rounded value.</br>
Numbers SIGN
    Syntax:</br> SIGN(numeric_expression)</br> Description:</br> Returns a value representing the positive (+1), zero (0), or negative (-1) sign of the given numeric expression.</br>
Numbers SIN
    Syntax:</br> SIN(numeric_expression)</br> Description:</br> Returns the sine of the angle specified in radians, in the given expression.</br>
Numbers SQRT
    Syntax:</br> SQRT(numeric_expression)</br> Description:</br> Returns the square root of the given numeric expression.</br>
Numbers TAN
    Syntax:</br> TAN(numeric_expression)</br> Description:</br> Returns the tangent of the given numeric expression.</br>
Aggregation AVG
    Syntax:</br> AVG(numeric_expression)</br> Description:</br> Returns the average of the values in the given expression.</br>
Aggregation COUNT
    Syntax:</br> COUNT(numeric_expression)</br> Description:</br> Returns the number of items in the given expression.</br>
Aggregation COUNTD
    Syntax:</br> COUNTD(numeric_expression)</br> Description:</br> Returns the distinct number of items in the given expression. </br>
Aggregation MAX
    Syntax:</br> MAX(numeric_expression)</br> Description:</br> Returns the maximum value in the given expression.</br> </br>
Aggregation MIN
    Syntax:</br> MIN(numeric_expression)</br> Description:</br> Returns the minimum value in the given expression.</br>
Aggregation STDEV
    Syntax:</br> STDEV(numeric_expression)</br> Description:</br> Returns the standard deviation of values in the given expression.</br>
Aggregation SUM
    Syntax:</br> SUM(numeric_expression)</br> Description:</br> Returns the sum of values in the given expression.</br>
Aggregation VAR
    Syntax:</br> VAR(numeric_expression)</br> Description:</br> Returns the variance of values in the given expression.</br>
Conditional COALESCE
    Syntax:</br> COALESCE(exp1,exp2,...exp(n))</br> Description:</br> Returns the first non-NULL expression among its arguments, or NULL if all its arguments are NULL.</br>
Conditional IF
    Syntax:</br> IF(expression, true_part, false_part)</br> Description:</br> Returns either true part or false part, depending on the evaluation of the expression.</br>
Conditional ISNULL
    Syntax:</br> ISNULL(expression)</br> Description:</br> Returns true if the given expression evaluates to null.</br>
Logical AND
    Syntax:</br> (expression1) AND (expression2)</br> Description:</br> Returns true if both the expressions evaluates to true.</br>
Logical NOT
    Syntax:</br> NOT(expression)</br> Description:</br> Returns the reversed logical value of the expression being evaluated.</br>
Logical OR
    Syntax:</br> (expression1) OR (expression2)</br> Description:</br> Returns true if any of the expressions evaluates to true.</br>
Date CURRENTMONTH
    Syntax:</br> CURRENTMONTH()</br> Description:</br> Returns the current month.</br>
Date CURRENTYEAR
    Syntax:</br> CURRENTYEAR()</br> Description:</br> Returns the current year.</br>
Date DATEADD
    Syntax:</br> DATEADD(numeric_expression, date_expression)</br> Description:</br> Adds the number of days to the specified date.</br>
Date DATESUB
    Syntax:</br> DATESUB(numeric_expression, date_expression)</br> Description:</br> Returns the date subtracted from the specified date.</br>
Date DAY
    Syntax:</br> DAY(date_expression)</br> Description:</br> Returns a numeric value representing the day part of the specified date.</br>
Date DAYDIFF
    Syntax:</br> DAYDIFF(start_date_expression, end_date_expression)</br> Description:</br> Returns a numeric value representing the difference between two specified dates.</br>
Date HOUR
    Syntax:</br> HOUR(date_expression)</br> Description:</br> Returns the hour of the given date as an integer.</br>
Date MINUTE
    Syntax:</br> MINUTE(date_expression)</br> Description:</br> Returns a numeric value representing the minute part of the date resulted from specified date expression.</br>
Date MONTH
    Syntax:</br> MONTH(date_expression)</br> Description:</br> Returns a numeric value representing the month part of the date resulted from specified date expression.</br>
Date NOW
    Syntax:</br> NOW()</br> Description:</br> Returns the current date and time.</br>
Date PREVIOUSMONTH
    Syntax:</br> PREVIOUSMONTH()</br> Description:</br> Returns the previous month.</br>
Date PREVIOUSYEAR
    Syntax:</br> PREVIOUSYEAR()</br> Description:</br> Returns the previous year.</br>
Date TODAY
    Syntax:</br> TODAY()</br> Description:</br> Returns the current date.</br>
Date YESTERDAY
    Syntax:</br> YESTERDAY()</br> Description:</br> Returns the yesterday date.</br>
Date YEAR
    Syntax:</br> YEAR(date_expression)</br> Description:</br> Returns a numeric value representing the year part of the date resulting from the specified date expression.</br>
Date DATENAME
    Syntax:</br> DATENAME(date_part, date_expression)</br> Description:</br> Returns a string representing the specified date_part of the given date expression.</br>
Date DATEPART
    Syntax:</br> DATEPART(date_part, date_expression)</br> Description:</br> Returns an integer value representing the specified date_part of the given date expression.</br>
Date MAX
    Syntax:</br> MAX(expression)</br> Description:</br> Returns the maximum value in the given expression.</br>
Date MIN
    Syntax:</br> MIN(expression)</br> Description:</br> Returns the minimum value in the given expression.</br>
String LEN
    Syntax:</br> LEN(string_expression)</br> Description:</br> Returns the number of characters in the given string expression.</br>
String CHAR
    Syntax:</br> CHAR(integer_expression)</br> Description:</br> Converts the given integer ASCII code into a character.</br>
String CONCAT
    Syntax:</br> CONCAT(string_expression1, string_expression2,…, string_expressionN)</br> Description:</br> Returns a string value resulting from the concatenation of two or more string values.</br>
String CONTAINS
    Syntax:</br> CONTAINS(string_expression, substring_expression)</br> Description:</br> Returns true if the given string expression contains the specified substring expression.</br>
String ENDSWITH
    Syntax:</br> ENDSWITH(string_expression substring_expression)</br> Description:</br> Returns true if the given string expression ends with the specified substring expression.</br>
String LEFT
    Syntax:</br> LEFT(string_expression, numeric_expression)</br> Description:</br> Returns the specified number of characters from start of the given string expression.</br>
String LOWER
    Syntax:</br> LOWER(string_expression)</br> Description:</br> Returns a lower case converted string value from a given string expression.</br>
String LTRIM
    Syntax:</br> LTRIM(string_expression)</br> Description:</br> Returns the string value with any leading blanks removed from string expression.</br>
String MAX
    Syntax:</br> MAX(expression)</br> Description:</br> Returns the maximum value in the given expression. </br>
String MIN
    Syntax:</br> MIN(expression)</br> Description:</br> Returns the minimum value in the given expression. </br>
String REPLACE
    Syntax:</br> REPLACE(string_expression, substring, new_substring)</br> Description:</br> Replaces all occurrences of the substring within the given string expression, with the new_substring.</br>
String RIGHT
    Syntax:</br> RIGHT(string_expression, numeric_expression)</br> Description:</br> Returns the specified number of characters from end of the given string expression.</br>
String RTRIM
    Syntax:</br> RTRIM(string_expression)</br> Description:</br> Returns the string value with any trailing blanks removed from string expression.</br>
String STARTSWITH
    Syntax:</br> STARTSWITH(string_expression, substring_expression)</br> Description:</br> Returns true if the given string expression starts with the specified substring expression.</br>
String SUBSTR
    Syntax:</br> SUBSTR(string_expression, starting_index, length_of_the_string)</br> Description:</br> Returns a specific length of string starting from specific index from the given string expression. </br>
String TRIM
    Syntax:</br> TRIM(string_expression)</br> Description:</br> Removes the leading and trailing spaces from the string expression.</br>
String UPPER
    Syntax:</br> UPPER(string_expression)</br> Description:</br> Returns an upper case converted string value from a given string expression.</br>

Once framing an expression, click Save in Query Expression window.

Deleting an expression column

Select an expression column in left pane.

Click Delete icon to remove the selected expression column.

Delete icon

Updating an expression column

Select an expression column in left pane that you need to update.

Edit the Name and Expression text areas, if required.

Click Save in Query Expression window to save the modifications handled.

Configuring expression column in widgets

Saved measure expression will be shown in Measure Columns section of ASSIGN DATA tab like below.

Expression columns

Saved dimension expression will be shown in Dimension Columns section of ASSIGN DATA tab like below.

Expression columns

You can also drag and drop expression column into widgets from measure or dimension fields or both.

Aggregation function expression

You can also apply filters for expression column which is used in widget. For numeric expressions, you can apply filter just like a measure filter. For string and date expressions, you can apply filter just like a dimension filter.

## Related Links
Blog Post - https://www.boldbi.com/blog/using-calculated-fields-in-your-dashboard