Functions
There are various types of functions that you can use in expressions.
Topics:
Aggregate Functions
Aggregate functions perform operations on multiple values to create summary results.
The following list describes the aggregation rules that are available for columns and measure columns. The list also includes functions that you can use when creating calculated items for analyses.
-
Default — Applies the default aggregation rule as in the semantic model or by the original author of the analysis. Not available for calculated items in analyses.
-
Server Determined — Applies the aggregation rule that's determined by the Oracle Analytics (such as the rule that is defined in the semantic model). The aggregation is performed within Oracle Analytics for simple rules such as Sum, Min, and Max. Not available for measure columns in the Layout pane or for calculated items in analyses.
-
Sum — Calculates the sum obtained by adding up all values in the result set. Use this for items that have numeric values.
-
Min — Calculates the minimum value (lowest numeric value) of the rows in the result set. Use this for items that have numeric values.
-
Max — Calculates the maximum value (highest numeric value) of the rows in the result set. Use this for items that have numeric values.
-
Average — Calculates the average (mean) value of an item in the result set. Use this for items that have numeric values. Averages on tables and pivot tables are rounded to the nearest whole number.
-
First — In the result set, selects the first occurrence of the item for measures. For calculated items, selects the first member according to the display in the Selected list. Not available in the Edit Column Formula dialog box.
-
Last — In the result set, selects the last occurrence of the item. For calculated items, selects the last member according to the display in the Selected list. Not available in the Edit Column Formula dialog box.
-
Count — Calculates the number of rows in the result set that have a non-null value for the item. The item is typically a column name, in which case the number of rows with non-null values for that column are returned.
-
Count Distinct — Adds distinct processing to the Count function, which means that each distinct occurrence of the item is counted only once.
-
None — Applies no aggregation. Not available for calculated items in analyses.
-
Report-Based Total (when applicable) — If not selected, specifies that the Oracle Analytics should calculate the total based on the entire result set, before applying any filters to the measures. Not available in the Edit Column Formula dialog box or for calculated items in analyses. Only available for attribute columns.
Function | Example | Description | Syntax |
---|---|---|---|
AGGREGATE AT |
|
Aggregates columns based on the level or levels in the data model hierarchy you specify.
You can optionally specify more than one level. You can't specify a level from a dimension that contains levels that are being used as the measure level for the measure you specified in the first argument. For example, you can't write the function as |
|
AGGREGATE BY | AGGREGATE(sales BY month, region) |
Aggregates a measure based on one or more dimension columns.
|
AGGREGATE(measure BY column [, column1, columnN]) |
AVG |
|
Calculates the average (mean) of a numeric set of values. |
|
AVGDISTINCT |
Calculates the average (mean) of all distinct values of an expression. |
|
|
BIN |
|
Classifies a given numeric expression into a specified number of equal width buckets. The function can return either the bin number or one of the two end points of the bin interval. numeric_expr is the measure or numeric attribute to bin. BY grain_expr1,…, grain_exprN is a list of expressions that define the grain at which the numeric_expr is calculated. BY is required for measure expressions and is optional for attribute expressions. WHERE a filter to apply to the numeric_expr before the numeric values are assigned to bins INTO number_of_bins BINS is the number of bins to return BETWEEN min_value AND max_value is the min and max values used for the end points of the outermost bins RETURNING NUMBER indicates that the return value should be the bin number (1, 2, 3, 4, etc.). This is the default. RETURNING RANGE_LOW indicates the lower value of the bin interval RETURNING RANGE_HIGH indicates the higher value of the bin interval |
|
BottomN |
Ranks the lowest n values of the expression argument from 1 to n, 1 corresponding to the lowest numerical value. expr is any expression that evaluates to a numerical value. integer is any positive integer. Represents the bottom number of rankings displayed in the result set, 1 being the lowest rank. |
|
|
COUNT |
|
Determines the number of items with a non-null value. |
|
COUNTDISTINCT |
Adds distinct processing to the COUNT function. expr is any expression. |
|
|
COUNT* |
|
Counts the number of rows. |
|
First |
|
Selects the first non-null returned value of the expression argument. The |
|
Last |
|
Selects the last non-null returned value of the expression. |
|
MAVG |
Calculates a moving average (mean) for the last n rows of data in the result set, inclusive of the current row. expr is any expression that evaluates to a numerical value. integer is any positive integer. Represents the average of the last n rows of data. |
|
|
MAX |
|
Calculates the maximum value (highest numeric value) of the rows satisfying the numeric expression argument. |
|
MEDIAN |
|
Calculates the median (middle) value of the rows satisfying the numeric expression argument. When there are an even number of rows, the median is the mean of the two middle rows. This function always returns a double. |
|
MIN |
|
Calculates the minimum value (lowest numeric value) of the rows satisfying the numeric expression argument. |
|
NTILE |
Determines the rank of a value in terms of a user-specified range. It returns integers to represent any range of ranks. NTILE with numTiles=100 returns what is commonly called the "percentile" (with numbers ranging from 1 to 100, with 100 representing the high end of the sort). expr is any expression that evaluates to a numerical value. numTiles is a positive, nonnull integer that represents the number of tiles. |
|
|
PERCENTILE |
Calculates a percentile rank for each value satisfying the numeric expression argument. The percentile rank ranges are between 0 (0th percentile) to 1 (100th percentile). expr is any expression that evaluates to a numerical value. |
|
|
RANK |
|
Calculates the rank for each value satisfying the numeric expression argument. The highest number is assigned a rank of 1, and each successive rank is assigned the next consecutive integer (2, 3, 4,...). If certain values are equal, they'reare assigned the same rank (for example, 1, 1, 1, 4, 5, 5, 7...). expr is any expression that evaluates to a numerical value. |
|
STDDEV |
|
Returns the standard deviation for a set of values. The return type is always a double. |
|
STDDEV_POP |
|
Returns the standard deviation for a set of values using the computational formula for population variance and standard deviation. |
|
SUM |
|
Calculates the sum obtained by adding up all values satisfying the numeric expression argument. |
|
SUMDISTINCT |
Calculates the sum obtained by adding all of the distinct values satisfying the numeric expression argument. expr is any expression that evaluates to a numerical value. |
|
|
TOPN |
Ranks the highest n values of the expression argument from 1 to n, 1 corresponding to the highest numerical value. expr is any expression that evaluates to a numerical value. integer is any positive integer. Represents the top number of rankings displayed in the result set, 1 being the highest rank. |
|
Analytics Functions
Analytics functions allow you to explore data using models such as trendline and cluster.
Function | Example | Description | Syntax |
---|---|---|---|
TRENDLINE |
|
Oracle recommends that you apply a Trendline using the Add Statistics property when viewing a visualization. See Adjust Visualization Properties. Fits a linear, polynomial, or exponential model, and returns the fitted values or model. The numeric_expr represents the Y value for the trend and the series (time columns) represent the X value. |
|
CLUSTER |
|
Collects a set of records into groups based on one or more input expressions using K-Means or Hierarchical Clustering. |
|
OUTLIER |
|
Classifies a record as Outlier based on one or more input expressions using K-Means or Hierarchical Clustering or Multi-Variate Outlier detection Algorithms. |
|
REGR |
|
Fits a linear model and returns the fitted values or model. This function can be used to fit a linear curve on two measures. |
|
Date and Time Functions
Date and time functions manipulate data based on DATE
and DATETIME
.
Function | Example | Description | Syntax |
---|---|---|---|
CONVERT_TZ | CONVERT_TZ(Order Date, 'UTC', 'America/Denver') |
Converts a datetime value expr from the time zone specified by Old time zone to the time zone specified by New time zone and returns the resulting value.
|
CONVERT_TZ(expr, 'Old time zone', 'New time zone') |
CURRENT_Date |
|
Returns the current date. The date is determined by the system in which the Oracle BI is running. |
|
CURRENT_TIME |
|
Returns the current time to the specified number of digits of precision, for example: HH:MM:SS.SSS If no argument is specified, the function returns the default precision. |
|
CURRENT_TIMESTAMP |
|
Returns the current date/timestamp to the specified number of digits of precision. |
|
DAYNAME |
|
Returns the name of the day of the week for a specified date expression. |
|
DAYOFMONTH |
|
Returns the number corresponding to the day of the month for a specified date expression. |
|
DAYOFWEEK |
|
Returns a number between 1 and 7 corresponding to the day of the week for a specified date expression. For example, 1 always corresponds to Sunday, 2 corresponds to Monday, and so on through to Saturday which returns 7. |
|
DAYOFYEAR |
|
Returns the number (between 1 and 366) corresponding to the day of the year for a specified date expression. |
|
DAY_OF_QUARTER |
|
Returns a number (between 1 and 92) corresponding to the day of the quarter for the specified date expression. |
|
HOUR |
|
Returns a number (between 0 and 23) corresponding to the hour for a specified time expression. For example, 0 corresponds to 12 a.m. and 23 corresponds to 11 p.m. |
|
MINUTE |
|
Returns a number (between 0 and 59) corresponding to the minute for a specified time expression. |
|
MONTH |
|
Returns the number (between 1 and 12) corresponding to the month for a specified date expression. |
|
MONTHNAME |
|
Returns the name of the month for a specified date expression. |
|
MONTH_OF_QUARTER |
|
Returns the number (between 1 and 3) corresponding to the month in the quarter for a specified date expression. |
|
NOW |
|
Returns the current timestamp. The |
|
QUARTER_OF_YEAR |
|
Returns the number (between 1 and 4) corresponding to the quarter of the year for a specified date expression. |
|
SECOND |
|
Returns the number (between 0 and 59) corresponding to the seconds for a specified time expression. |
|
TIMESTAMPADD |
|
Adds a specified number of intervals to a timestamp, and returns a single timestamp. Interval options are: SQL_TSI_SECOND, SQL_TSI_MINUTE, SQL_TSI_HOUR, SQL_TSI_DAY, SQL_TSI_WEEK, SQL_TSI_MONTH, SQL_TSI_QUARTER, SQL_TSI_YEAR |
|
TIMESTAMPDIFF |
|
Returns the total number of specified intervals between two timestamps. Use the same intervals as TIMESTAMPADD. |
|
WEEK_OF_QUARTER |
|
Returns a number (between 1 and 13) corresponding to the week of the quarter for the specified date expression. |
|
WEEK_OF_YEAR |
|
Returns a number (between 1 and 53) corresponding to the week of the year for the specified date expression. |
|
YEAR |
|
Returns the year for the specified date expression. |
|
Date Extraction Functions
These functions calculate or round-down timestamp values to the nearest specified time period, such as hour, day, week, month, and quarter.
You can use the calculated timestamps to aggregate data using a different grain. For example, you might apply the EXTRACTDAY()
function to sales order dates to calculate a timestamp for midnight on the day that orders occur, so that you can aggregate the data by day.
Function | Example | Description | Syntax |
---|---|---|---|
Extract Day |
EXTRACTDAY("Order Date")
|
Returns a timestamp for midnight (12 AM) on the day in which the input value occurs. For example, if the input timestamp is for 3:02:01 AM on February 22nd, the function returns the timestamp for 12:00:00 AM on February 22nd. |
|
Extract Hour |
EXTRACTHOUR("Order Date")
|
Returns a timestamp for the start of the hour in which the input value occurs. For example, if the input timestamp is for 11:18:30 PM, the function returns the timestamp for 11:00:00 PM. |
|
Extract Hour of Day |
EXTRACTHOUROFDAY("Order Date")
|
Returns a timestamp where the hour equals the hour of the input value with default values for year, month, day, minutes, and seconds. |
|
Extract Millisecond |
EXTRACTMILLISECOND("Order Date")
|
Returns a timestamp containing milliseconds for the input value. For example, if the input timestamp is for 15:32:02.150, the function returns the timestamp for 15:32:02.150. |
|
Extract Minute |
EXTRACTMINUTE("Order Date")
|
Returns a timestamp for the start of the minute in which the input value occurs. For example, if the input timestamp is for 11:38:21 AM, the function returns the timestamp for 11:38:00 AM. |
|
Extract Month |
EXTRACTMONTH("Order Date")
|
Returns a timestamp for the first day in the month in which the input value occurs. For example, if the input timestamp is for February 22nd, the function returns the timestamp for February 1st. |
|
Extract Quarter |
EXTRACTQUARTER("Order Date")
|
Returns a timestamp for the first day in the quarter in which the input value occurs. For example, if the input timestamp occurs in the third fiscal quarter, the function returns the timestamp for July 1st. |
|
Extract Second |
EXTRACTSECOND("Order Date")
|
Returns a timestamp for the input value. For example, if the input timestamp is for 15:32:02.150, the function returns the timestamp for 15:32:02. |
|
Extract Week |
EXTRACTWEEK("Order Date")
|
Returns the date of the first day of the week (Sunday) in which the input value occurs. For example, if the input timestamp is for Wednesday, September 24th, the function returns the timestamp for Sunday, September 21st. |
|
Extract Year |
EXTRACTYEAR("Order Date")
|
Returns a timestamp for January 1st for the year in which the input value occurs. For example, if the input timestamp occurs in 1967, the function returns the timestamp for January 1st, 1967. |
|
Conversion Functions
Conversion functions convert a value from one form to another.
Function | Example | Description | Syntax |
---|---|---|---|
CAST |
|
Changes the data type of an expression or a null literal to another data type. For example, you can cast a customer_name (a data type of Use Don’t use |
|
IFNULL |
|
Tests if an expression evaluates to a null value, and if it does, assigns the specified value to the expression. |
|
INDEXCOL |
|
Uses external information to return the appropriate column for the signed-in user to see. |
|
NULLIF |
|
Compares two expressions. If they’re equal, then the function returns NULL. If they’re not equal, then the function returns the first expression. You can’t specify the literal NULL for the first expression. |
|
To_DateTime |
|
Converts string literals of DateTime format to a DateTime data type. |
|
VALUEOF |
|
References the value of a semantic model variable in a filter. Use expr variables as arguments of the |
|
Display Functions
Display functions operate on the result set of a query.
Function | Example | Description | Syntax |
---|---|---|---|
BottomN |
|
Returns the n lowest values of expression, ranked from lowest to highest. |
|
FILTER |
|
Computes the expression using the given preaggregate filter. |
|
MAVG |
|
Calculates a moving average (mean) for the last n rows of data in the result set, inclusive of the current row. |
|
MSUM |
|
Calculates a moving sum for the last n rows of data, inclusive of the current row. The sum for the first row is equal to the numeric expression for the first row. The sum for the second row is calculated by taking the sum of the first two rows of data, and so on. When the n th row is reached, the sum is calculated based on the last n rows of data. |
|
NTILE |
|
Determines the rank of a value in terms of a user-specified range. It returns integers to represent any range of ranks. The example shows a range from 1 to 100, with the lowest sale = 1 and the highest sale = 100. |
|
PERCENTILE |
|
Calculates a percent rank for each value satisfying the numeric expression argument. The percentile rank ranges are from 0 (1st percentile) to 1 (100th percentile), inclusive. |
|
RANK |
|
Calculates the rank for each value satisfying the numeric expression argument. The highest number is assigned a rank of 1, and each successive rank is assigned the next consecutive integer (2, 3, 4,...). If certain values are equal, they're assigned the same rank (for example, 1, 1, 1, 4, 5, 5, 7...). |
|
RCOUNT |
|
Takes a set of records as input and counts the number of records encountered so far. |
|
RMAX |
|
Takes a set of records as input and shows the maximum value based on records encountered so far. The specified data type must be one that can be ordered. |
|
RMIN |
|
Takes a set of records as input and shows the minimum value based on records encountered so far. The specified data type must be one that can be ordered. |
|
RSUM |
|
Calculates a running sum based on records encountered so far. The sum for the first row is equal to the numeric expression for the first row. The sum for the second row is calculated by taking the sum of the first two rows of data, and so on. |
|
TOPN |
|
Returns the n highest values of expression, ranked from highest to lowest. |
|
Tips on Using Display Functions
- FILTER - If you're building a report using a subject area, use hierarchies defined in the subject area instead of filtering hierarchy columns directly in a calculation. In other words, if a subject area has a hierarchy for Time\Fiscal Year\Fiscal Quarter, then avoid:
filter (<measure> using fiscal_quarter = 'Q4')
filter (<measure> using fiscal_quarter = 'Q3')
filter (<measure> using fiscal_year = 'FY24')
Evaluate Functions
Evaluate functions are database functions that can be used to pass through expressions to get advanced calculations.
Embedded database functions can require one or more columns. These columns are referenced by %1 ... %N within the function. The actual columns must be listed after the function.
Function | Example | Description | Syntax |
---|---|---|---|
EVALUATE |
|
Passes the specified database function with optional referenced columns as parameters to the database for evaluation. |
|
EVALUATE_AGGR |
|
Passes the specified database function with optional referenced columns as parameters to the database for evaluation. This function is intended for aggregate functions with a |
|
Mathematical Functions
The mathematical functions described in this section perform mathematical operations.
Function | Example | Description | Syntax |
---|---|---|---|
ABS |
|
Calculates the absolute value of a numeric expression. expr is any expression that evaluates to a numerical value. |
|
ACOS |
|
Calculates the arc cosine of a numeric expression. expr is any expression that evaluates to a numerical value. |
|
ASIN |
|
Calculates the arc sine of a numeric expression. expr is any expression that evaluates to a numerical value. |
|
ATAN |
|
Calculates the arc tangent of a numeric expression. expr is any expression that evaluates to a numerical value. |
|
ATAN2 |
|
Calculates the arc tangent of y /x, where y is the first numeric expression and x is the second numeric expression. |
|
CEILING |
|
Rounds a non-integer numeric expression to the next highest integer. If the numeric expression evaluates to an integer, the |
|
COS |
|
Calculates the cosine of a numeric expression. expr is any expression that evaluates to a numerical value. |
|
COT |
|
Calculates the cotangent of a numeric expression. expr is any expression that evaluates to a numerical value. |
|
DEGREES |
|
Converts an expression from radians to degrees. expr is any expression that evaluates to a numerical value. |
|
EXP |
|
Sends the value to the power specified. Calculates e raised to the n-th power, where e is the base of the natural logarithm. |
|
ExtractBit |
|
Retrieves a bit at a particular position in an integer. It returns an integer of either 0 or 1 corresponding to the position of the bit. |
|
FLOOR |
|
Rounds a non-integer numeric expression to the next lowest integer. If the numeric expression evaluates to an integer, the |
FLOOR(expr) |
LOG |
|
Calculates the natural logarithm of an expression. expr is any expression that evaluates to a numerical value. |
|
LOG10 |
|
Calculates the base 10 logarithm of an expression. expr is any expression that evaluates to a numerical value. |
|
MOD |
|
Divides the first numeric expression by the second numeric expression and returns the remainder portion of the quotient. |
|
PI |
|
Returns the constant value of pi. |
|
POWER |
|
Takes the first numeric expression and raises it to the power specified in the second numeric expression. |
|
RADIANS |
|
Converts an expression from degrees to radians. expr is any expression that evaluates to a numerical value. |
|
RAND |
|
Returns a pseudo-random number between 0 and 1. |
|
RANDFromSeed |
|
Returns a pseudo-random number based on a seed value. For a given seed value, the same set of random numbers are generated. |
|
ROUND |
|
Rounds a numeric expression to n digits of precision. expr is any expression that evaluates to a numerical value. integer is any positive integer that represents the number of digits of precision. |
|
SIGN |
|
Returns the following:
|
|
SIN |
|
Calculates the sine of a numeric expression. |
|
SQRT |
|
Calculates the square root of the numeric expression argument. The numeric expression must evaluate to a nonnegative number. |
|
TAN |
|
Calculates the tangent of a numeric expression. expr is any expression that evaluates to a numerical value. |
|
TRUNCATE |
|
Truncates a decimal number to return a specified number of places from the decimal point. expr is any expression that evaluates to a numerical value. integer is any positive integer that represents the number of characters to the right of the decimal place to return. |
|
Running Aggregate Functions
Running aggregate functions perform operations on multiple values to create summary results.
Function | Example | Description | Syntax |
---|---|---|---|
MAVG |
Calculates a moving average (mean) for the last n rows of data in the result set, inclusive of the current row. expr is any expression that evaluates to a numerical value. integer is any positive integer. Represents the average of the last n rows of data. |
|
|
MSUM |
|
Calculates a moving sum for the last n rows of data, inclusive of the current row. expr is any expression that evaluates to a numerical value. integer is any positive integer. Represents the sum of the last n rows of data. |
|
RSUM |
|
Calculates a running sum based on records encountered so far. expr is any expression that evaluates to a numerical value. |
|
RCOUNT |
|
Takes a set of records as input and counts the number of records encountered so far. expr is an expression of any datatype. |
|
RMAX |
|
Takes a set of records as input and shows the maximum value based on records encountered so far. expr is an expression of any datatype. |
|
RMIN |
|
Takes a set of records as input and shows the minimum value based on records encountered so far. expr is an expression of any datatype. |
|
Spatial Functions
Spatial functions enable you to perform geographical analysis when you model data. For example, you might calculate the distance between two geographical areas (known as shapes or polygons).
Note:
You can't use these spatial functions in custom calculations for visualization workbooks.Function | Example | Description | Syntax |
---|---|---|---|
GeometryArea |
|
Calculates the area that a shape occupies. |
|
GeometryDistance |
|
Calculates the distance between two shapes. |
|
GeometryLength |
|
Calculates the circumference of a shape. |
|
GeometryRelate |
|
Determines whether one shape is inside another shape. Returns TRUE or FALSE as a string (varchar). |
|
GeometryWithinDistance |
|
Determines whether two shapes are within a specified distance of each other. Returns TRUE or FALSE as a string (varchar). |
|
String Functions
String functions perform various character manipulations. They operate on character strings.
Function | Example | Description | Syntax |
---|---|---|---|
ASCII |
|
Converts a single character string to its corresponding ASCII code, between 0 and 255. If the character expression evaluates to multiple characters, the ASCII code corresponding to the first character in the expression is returned. expr is any expression that evaluates to a character string. |
|
BIT_LENGTH |
|
Returns the length, in bits, of a specified string. Each Unicode character is 2 bytes in length (equal to 16 bits). expr is any expression that evaluates to a character string. |
|
CHAR |
|
Converts a numeric value between 0 and 255 to the character value corresponding to the ASCII code. expr is any expression that evaluates to a numerical value between 0 and 255. |
|
CHAR_LENGTH |
|
Returns the length, in number of characters, of a specified string. Leading and trailing blanks aren’t counted in the length of the string. expr is any expression that evaluates to a character string. |
|
CONCAT |
|
Concatenates two character strings. exprs are expressions that evaluate to character strings, separated by commas. You must use raw data, not formatted data, with |
|
INSERT |
|
Inserts a specified character string into a specified location in another character string. expr1 is any expression that evaluates to a character string. Identifies the target character string. integer1 is any positive integer that represents the number of characters from the beginning of the target string where the second string is to be inserted. integer2 is any positive integer that represents the number of characters in the target string to be replaced by the second string. expr2 is any expression that evaluates to a character string. Identifies the character string to be inserted into the target string. |
|
LEFT |
|
Returns a specified number of characters from the left of a string. expr is any expression that evaluates to a character string integer is any positive integer that represents the number of characters from the left of the string to return. |
|
LENGTH |
|
Returns the length, in number of characters, of a specified string. The length is returned excluding any trailing blank characters. expr is any expression that evaluates to a character string. |
|
LOCATE |
|
Returns the numeric position of a character string in another character string. If the character string isn’t found in the string being searched, the function returns a value of 0. expr1 is any expression that evaluates to a character string. Identifies the string for which to search. expr2 is any expression that evaluates to a character string. Identifies the string to be searched. |
|
LOCATEN |
|
Like LOCATE, returns the numeric position of a character string in another character string. LOCATEN includes an integer argument that enables you to specify a starting position to begin the search. expr1 is any expression that evaluates to a character string. Identifies the string for which to search. expr2 is any expression that evaluates to a character string. Identifies the string to be searched. integer is any positive (nonzero) integer that represents the starting position to begin to look for the character string. |
|
LOWER |
|
Converts a character string to lowercase. expr is any expression that evaluates to a character string. |
|
OCTET_LENGTH |
|
Returns the number of bytes of a specified string. expr is any expression that evaluates to a character string. |
|
POSITION |
|
Returns the numeric position of strExpr1 in a character expression. If strExpr1 isn’t found, the function returns 0. expr1 is any expression that evaluates to a character string. Identifies the string to search for in the target string. For example, "d". expr2 is any expression that evaluates to a character string. Identifies the target string to be searched. For example, "abcdef". |
|
REPEAT |
|
Repeats a specified expression n times. expr is any expression that evaluates to a character string integer is any positive integer that represents the number of times to repeat the character string. |
|
REPLACE |
|
Replaces one or more characters from a specified character expression with one or more other characters. expr1 is any expression that evaluates to a character string. This is the string in which characters are to be replaced. expr2 is any expression that evaluates to a character string. This second string identifies the characters from the first string that are to be replaced. expr3 is any expression that evaluates to a character string. This third string specifies the characters to substitute into the first string. |
|
RIGHT |
|
Returns a specified number of characters from the right of a string. expr is any expression that evaluates to a character string. integer is any positive integer that represents the number of characters from the right of the string to return. |
|
SPACE |
|
Inserts blank spaces. integer is any positive integer that indicates the number of spaces to insert. |
|
SUBSTRING |
|
Creates a new string starting from a fixed number of characters into the original string. expr is any expression that evaluates to a character string. startPos is any positive integer that represents the number of characters from the start of the left side of the string where the result is to begin. |
|
SUBSTRINGN |
|
Like SUBSTRING, creates a new string starting from a fixed number of characters into the original string. SUBSTRINGN includes an integer argument that enables you to specify the length of the new string, in number of characters. expr is any expression that evaluates to a character string. startPos is any positive integer that represents the number of characters from the start of the left side of the string where the result is to begin. |
|
TrimBoth |
|
Strips specified leading and trailing characters from a character string. char is any single character. If you omit this specification (and the required single quotes), a blank character is used as the default. expr is any expression that evaluates to a character string. |
|
TRIMLEADING |
|
Strips specified leading characters from a character string. char is any single character. If you omit this specification (and the required single quotes), a blank character is used as the default. expr is any expression that evaluates to a character string. |
|
TRIMTRAILING |
|
Strips specified trailing characters from a character string. char is any single character. If you omit this specification (and the required single quotes), a blank character is used as the default. expr is any expression that evaluates to a character string. |
|
UPPER |
|
Converts a character string to uppercase. expr is any expression that evaluates to a character string. |
|
System Functions
The USER
system function returns values relating to the
session. For example, the user name you signed in with.
Function | Example | Description | Syntax |
---|---|---|---|
DATABASE |
Returns the name of the subject area to which you're logged on. |
|
|
USER |
Returns the user name for the semantic model to which you're logged on. |
|
Time Series Functions
Time series functions enable you to aggregate and forecast data based on time dimensions. For example, you might use the AGO function to calculate revenue from one year ago.
Time dimension members must be at or below the level of the function. Because of this, one or more columns that uniquely identify members at or below the given level must be projected in the query.
Function | Example | Description | Syntax |
---|---|---|---|
AGO |
|
Calculates the aggregated value of a measure in a specified time period in the past. For example, to calculate monthly revenue one year ago, use |
Where:
|
PERIODROLLING |
|
Calculates the aggregate of a measure over the period starting x units of time and ending y units of time from the current time. For example, |
Where:
|
TODATE |
|
Calculates the aggregated value of a measure from the start of a time period to the latest time period, for example, year to date calculations. For example, to calculate Year to Date Sales, use |
Where:
|