MDX Function Reference
flex.bi uses Mondrian OLAP reporting engine and MDX query language implementation. In addition to Mondrian provided MDX functions flex.bi defines additional MDX functions which can be used in calculated member formulas. Please start with an introduction about calculated members to learn how to create calculated members and MDX calculation formulas.
This page lists all supported MDX functions grouped by their category of return value, or you can select function by name from the alphabetical list in the table of contents (in the left navigation sidebar).
Operators
Operator | Description |
|---|---|
CAST | The CAST operator converts scalar expressions to other types, NUMERIC, STRING, or BOOLEAN. The expression is |
IS | Compares and returns whether two objects (Member, Level, Hierarchy, Dimension, Tuple) are the same. |
MATCHES | The MATCHES and NOT MATCHES operators compare a string with another string or regular expression. |
+ | Adds two numbers |
- | Substracts two numbers. Or returns the negative of a number |
* | Multiplies two numbers |
/ | Divides two numbers |
= | Compares and returns whether two expressions are equal. |
|| | Concatenates two strings |
Date Functions
Function | Description |
|---|---|
Returns the date plus the specified number of the chosen time units, year (yyyy), quarter (q), month (m), week (ww), day (d), hour (h), minute (n). | |
Returns the date plus the specified number of days. | |
Returns the date plus the specified number of workdays. | |
Returns the date that is parsed from a string argument. | |
Returns the date for the specified year, month, and day. | |
DateToTimestamp | Transforms date and time from date format to timestamp format (integer). |
Returns the date without the time from the provided date or string argument. | |
getDate | Similar to get function but will always return the member property value as a datetime value. |
Returns the start date of the next time period. | |
Returns the current date and time according your flex.bi server system date and time. | |
Returns the time period start date. | |
TimestampToDate | Transforms date and time from timestamp format (integer) to date format. |
Hierarchy Functions
Function | Description |
|---|---|
Returns the current Time dimension hierarchy (default or Weekly) based on currently used hierarchy. | |
Returns the hierarchy that contains a specified member or level. | |
Returns the dimension that contains a specified member, level, or hierarchy. | |
Dimensions | Returns a hierarchy specified by a numeric or string expression. |
Level Functions
Function | Description |
|---|---|
Returns the level of a member. | |
Levels | Returns the level whose position in a dimension or hierarchy is specified by a numeric expression or whose name is specified by a string expression. |
Logical Functions
Function | Description |
|---|---|
Returns if any date from comma separated string is between time period start and end dates. | |
Determines if an expression evaluates to the empty cell value. | |
Returns if date is after time period end date. | |
Returns if date is before time period end date. | |
Returns if date is between other two dates. | |
Returns if date is between time period start and end dates. | |
getBoolean | Similar to get function but will always return the member property value as a boolean |
Member Functions
Function | Description |
|---|---|
Returns the ancestor of a member at a specified level or distance. | |
ClosingPeriod | Returns the last sibling among the descendants of a member at a specified level. |
Returns the Time dimension hierarchy level member which contains current date. | |
Returns current Time dimension hierarchy (default or Weekly) member based on currently used hierarchy. | |
Returns the current member along a specified dimension or hierarchy during iteration. | |
CurrentUserEmail | Returns an email of the user which is currently using flex.bi |
CurrentUserName | Returns a name of the user which is currently using flex.bi |
DataMember | Returns the system-generated data member that is associated with a nonleaf member of a dimension. |
Return Time dimension level member that matches the provided date. | |
Returns Time dimension level members between two dates. | |
Returns the default member of a dimension or hierarchy. | |
FirstChild | Returns the first child of a member. |
FirstSibling | Returns the first child of the parent of a member. |
Returns a set of future time dimension members starting from the given Time member. | |
GetLinkedMember | Returns member with a specified key value in the same dimension level or specific hierarchy level. |
GetLinkedMembers | Returns members with specified keys in the same dimension level or specific hierarchy level. |
GetLinkedMemberName | Returns name of linked member with a specified key value in the same dimension level or specific hierarchy level. |
GetLinkedMemberNames | Returns names of members with specified keys in the same dimension level or specific hierarchy level. |
Returns level member with specified key value. | |
GetMemberNamesByKeys | Returns names of level members with the specified key values. |
Returns a member from a specified tuple. | |
Lag | Returns the member that is a specified number of positions before a specified member along the member's dimension. |
LastChild | Returns the last child of a specified member. |
LastSibling | Returns the last child of the parent of a specified member. |
Lead | Returns the member that is a specified number of positions following a specified member along the member's dimension. |
Members | Returns a member specified by a string expression. |
NextMember | Returns the next member in the level that contains a specified member. |
OpeningPeriod | Returns the first sibling among the descendants of a specified level, optionally at a specified member. |
Returns a member from a prior period in the same relative position as a specified member. | |
Parent | Returns the parent of a member. |
Returns the previous member in the level that contains a specified member. | |
Returns a set of previous time dimension members for calculation of cumulative sums. | |
StrToMember | Returns the member specified by an MDX–formatted string. |
Numeric Functions
Function | Description |
|---|---|
Abs | Returns the absolute value of a number. |
Returns a calculated value using the appropriate aggregate function, based on the context of the query. | |
Returns the average value of a numeric expression evaluated. | |
CoalesceEmpty | Coalesces an empty cell value to a number or string and returns the coalesced value. |
Calculates the value only once per report execution and per each column and stores those values in the cache | |
Calculates the value once per report execution and stores it as one value in the cache | |
Correlation | Returns the correlation coefficient of two series evaluated over a set. |
Returns the number of tuples in a set. | |
Covariance | Returns the population covariance of two series evaluated over a set, using the biased population formula. |
CovarianceN | Returns the sample covariance of two series evaluated over a set, using the unbiased population formula. |
Calculates the sum of visible row values cumulatively | |
Returns -1 if first date is less than second date, 1 if first date is greater than second date, and 0 if dates are equal. | |
Returns difference in days from first date to second date. | |
Returns difference in workdays from first date to second date. | |
DateDiffHours | Returns difference in hours from first date to second date. |
DateDiffMinutes | Returns difference in minutes from first date to second date. |
Returns difference in workhours from first date to second date. | |
FirstQ | Returns the 1st quartile value of a numeric expression evaluated over a set. |
getNumber | Similar to get function but will always return the member property value as a numeric value. |
IIf | Returns one of two values determined by a logical test. |
Returns the next lowest integer | |
Len | Returns the number of characters in a string |
LinRegIntercept | Calculates the linear regression of a set and returns the value of b in the regression line y = ax + b. |
Calculates the linear regression of a set and returns the value of y in the regression line y = ax + b. | |
LinRegR2 | Calculates the linear regression of a set and returns R2 (the coefficient of determination). |
LinRegSlope | Calculates the linear regression of a set and returns the variance associated with the regression line y = ax + b. |
Max | Returns the maximum value of a numeric expression evaluated over a set. |
Median | Returns the median value of a numeric expression evaluated over a set. |
Min | Returns the minimum value of a numeric expression evaluated over a set. |
NonZero | Returns numeric value if non-zero. |
Ordinal | Returns the zero-based ordinal value associated with a level. |
Returns the value of the tuple that is at a given percentile of a set. | |
Power | Performs an arithmetic operation that raises one number by another number. |
Returns the expression value of the preceding row (row above). | |
Returns the one-based rank of a specified tuple in a specified set. | |
Rounds the values in its first argument to the specified number of decimal places. | |
Provides a JSON result that can be used with flex.bi Sparkline formatter. | |
Stddev | Alias for Stdev. |
StddevP | Alias for StdevP. |
Stdev | Returns the sample standard deviation of a numeric expression evaluated over a set, using the unbiased population formula. |
StdevP | Returns the population standard deviation of a numeric expression evaluated over a set, using the biased population formula. |
Returns the sum of a numeric expression evaluated over a set. | |
ThirdQ | Returns the 3rd quartile value of a numeric expression evaluated over a set. |
Returns the numbers contained in a string as a numeric value of appropriate type. | |
Value | Returns the value of a measure. |
Var | Returns the sample variance of a numeric expression evaluated over a set, using the unbiased population formula. |
VarP | Returns the population variance of a numeric expression evaluated over a set, using the biased population formula. |
Variance | Alias for Var. |
VarianceP | Alias for VarP. |
Set Functions
Function | Description |
|---|---|
AddCalculatedMembers | Returns a set generated by adding calculated members to a specified set. |
AllMembers | Returns a set that contains all members, including calculated members, of the specified dimension, hierarchy, or level. |
Ascendants | Returns the set of the ascendants of a specified member, including the member itself. |
BottomCount | Returns a specified number of items from the bottom of a set, optionally ordering the set first. |
BottomPercent | Sorts a set and returns the bottom N elements whose cumulative total is at least a specified percentage. |
BottomSum | Sorts a set and returns the bottom N elements whose cumulative total is at least a specified value. |
Caches the result of the calculation in memory for query in execution. Can be useful when same calculation is repeated during the report more than once. | |
Returns cascading children set of aggregate calculated member (set argument of Aggregate function). If any children member is also an aggregated calculated member then it is expanded to detailed members as well. | |
Children | Returns the children of a specified member. |
Returns children set of aggregate calculated member (set argument of Aggregate function). | |
Crossjoin |