Configuring Expression Columns
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 either through the Settings
menu with certain built-in functions based on the respective column or through the expression designer.
Note
Adding expression column through the Settings menu in table design view is not supported for SSAS data source currently.
Using Date Expressions
Using Aggregation Functions
Using Arithmetic Function
Using Expression Designer
Expression Designer can be launched either through the tools pane in the data design view highlighted below:
Or through the Expression Columns
container in Widget View highlighted below:
Click Add
in the Expression Designer
window to add a new expression column.
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. The syntax for defining a simple expression is,
{function name(}[columnname]{operator[columnname]…}
Where, content within curly braces is optional.
Following built-in functions are supported in Expression Designer.
Note
Currently, SSAS data source supports only functions existing under Numbers category.
Some expressions for reference: | ||
---|---|---|
|
||
Additional information | ||
|
||
Category | Functions | Syntax & Descriptions |
Numbers | ABS |
ABS(numeric_expression) Description: Returns the absolute value of the given expression. |
Numbers | ACOS |
ACOS(numeric_expression) Description: Returns the inverse cosine (also known as arccosine) of the given numeric expression. |
Numbers | ASIN |
ASIN(numeric_expression) Description: Returns the inverse sine (also known as arcsine) of the given numeric expression. |
Numbers | ATAN |
ATAN(numeric_expression) Description: Returns the inverse tangent (also known as arctangent) of the given numeric expression. |
Numbers | COS |
COS(numeric_expression) Description: Returns the cosine of the angle specified in radians, in the given expression. |
Numbers | DEGREES |
DEGREES(numeric_expression) Description: Returns the angle in degrees for the one specified in radians, in the given numeric expression. |
Numbers | EXP |
EXP(numeric_expression) Description: Returns the exponential value of the given expression. |
Numbers | LOG |
LOG(numeric_expression) Description: Returns the logarithm of the given expression to the specified base. |
Numbers | PI |
PI() Description: Returns the constant value of PI. |
Numbers | POWER |
POWER(expression1, expression2) Description: Returns the value of the given expression (expression1) to the specified power (expression2). |
Numbers | RADIANS |
RADIANS(numeric_expression) Description: Returns the angle in radians for the one specified in degrees, in the given numeric expression. |
Numbers | ROUND |
ROUND(numeric_expression) Description: Returns a rounded value. |
Numbers | SIGN |
SIGN(numeric_expression) Description: Returns a value representing the positive (+1), zero (0), or negative (-1) sign of the given numeric expression. |
Numbers | SIN |
SIN(numeric_expression) Description: Returns the sine of the angle specified in radians, in the given expression. |
Numbers | SQRT |
SQRT(numeric_expression) Description: Returns the square root of the given numeric expression. |
Numbers | TAN |
TAN(numeric_expression) Description: Returns the tangent of the given numeric expression. |
Aggregation | AVG |
AVG(numeric_expression) Description: Returns the average of the values in the given expression. |
Aggregation | COUNT |
COUNT(numeric_expression) Description: Returns the number of items in the given expression. |
Aggregation | COUNTD |
COUNTD(numeric_expression) Description: Returns the distinct number of items in the given expression. |
Aggregation | MAX |
MAX(numeric_expression) Description: Returns the maximum value in the given expression. |
Aggregation | MIN |
MIN(numeric_expression) Description: Returns the minimum value in the given expression. |
Aggregation | STDEV |
STDEV(numeric_expression) Description: Returns the standard deviation of values in the given expression. |
Aggregation | SUM |
SUM(numeric_expression) Description: Returns the sum of values in the given expression. |
Aggregation | VAR |
VAR(numeric_expression) Description: Returns the variance of values in the given expression. |
Conditional | IF |
IF(expression, true_part, false_part) Description: Returns either true part or false part, depending on the evaluation of the expression.
|
Conditional | ISNULL |
ISNULL(expression) Description: Returns a string value representing true if the given expression evaluates to null. |
Logical | AND |
(expression1) AND (expression2) Description: Returns true if both the expressions evaluates to true. |
Logical | NOT |
NOT(expression) Description: Returns the reversed logical value of the expression being evaluated. |
Logical | OR |
(expression1) OR (expression2) Description: Returns true if any of the expressions evaluates to true. |
Logical |
|
|
Date | DATEADD |
DATEADD(numeric_expression, date_expression) Description: Adds the number of days to the specified date. |
Date | DATESUB |
DATESUB(numeric_expression, date_expression) Description: Returns the date subtracted from the specified date. |
Date | DAY |
DAY(date_expression) Description: Returns a numeric value representing the day part of the specified date. |
Date | DAYDIFF |
DAYDIFF(start_date_expression, end_date_expression) Description: Returns a numeric value representing the difference between two specified dates. |
Date | HOUR |
HOUR(date_expression) Description: Returns the hour of the given date as an integer. |
Date | MINUTE |
MINUTE(date_expression) Description: Returns a numeric value representing the minute part of the date resulted from specified date expression. |
Date | MONTH |
MONTH(date_expression) Description: Returns a numeric value representing the month part of the date resulted from specified date expression. |
Date | NOW |
NOW() Description: Returns the current date and time. |
Date | TODAY |
TODAY() Description: Returns the current date. |
Date | YEAR |
YEAR(date_expression) Description: Returns a numeric value representing the year part of the date resulting from the specified date expression. |
Date | DATENAME |
DATENAME(date_part, date_expression) Description: Returns a string representing the specified date_part of the given date expression. |
Date | DATEPART |
DATEPART(date_part, date_expression) Description: Returns an integer value representing the specified date_part of the given date expression. |
Date | MAX |
MAX(expression) Description: Returns the maximum value in the given expression. |
Date | MIN |
MIN(expression) Description: Returns the minimum value in the given expression. |
String | LEN |
LEN(string_expression) Description: Returns the number of characters in the given string expression. |
String | CHAR |
CHAR(integer_expression) Description: Converts the given integer ASCII code into a character. |
String | CONCAT |
CONCAT(string_expression1, string_expression2,…, string_expressionN) Description: Returns a string value resulting from the concatenation of two or more string values. |
String | CONTAINS |
CONTAINS(string_expression, substring_expression) Description: Returns a string value representing true if the given string expression contains the specified substring expression.
When comparing to a string value,you may use upper or lower case regardless,this is case insensitive. |
String | ENDSWITH |
ENDSWITH(string_expression substring_expression) Description: Returns a string value representing true if the given string expression ends with the specified substring expression. |
String | LEFT |
LEFT(string_expression, numeric_expression) Description: Returns the specified number of characters from start of the given string expression. |
String | LOWER |
LOWER(string_expression) Description: Returns a lower case converted string value from a given string expression. |
String | LTRIM |
LTRIM(string_expression) Description: Returns the string value with any leading blanks removed from string expression. |
String | MAX |
MAX(expression) Description: Returns the maximum value in the given expression. |
String | MIN |
MIN(expression) Description: Returns the minimum value in the given expression. |
String | RIGHT |
RIGHT(string_expression, numeric_expression) Description: Returns the specified number of characters from end of the given string expression. |
String | RTRIM |
RTRIM(string_expression) Description: Returns the string value with any trailing blanks removed from string expression. |
String | STARTSWITH |
STARTSWITH(string_expression, substring_expression) Description: Returns a string value representing true if the given string expression starts with the specified substring expression. |
String | SUBSTR |
SUBSTR(string_expression, starting_index, length_of_the_string) Description: Returns a specific length of string starting from specific index from the given string expression. |
String | UPPER |
UPPER(string_expression) Description: Returns an upper case converted string value from a given string expression. |
You may also include the function names and the column names just by placing the cursor in respective position in the Expression
text area and double-clicking the specific name in respective lists.
Once framing an expression, click Save
in Expression Designer window.
Deleting an Expression Column
Select an expression column in left pane.
Click Delete
to remove the selected expression column.
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 Expression Designer window to save the modifications handled.