Replace
Replaces one substring with another in the defined string. In the given String1_Expression
, the function finds a fragment String2_Expression
and replaces it with a new value String3_Expression
.
Syntax
Replace(String1_Expression, String2_Expression, String3_Expression)
Arguments
String1_Expression | MDX expression returning an original string that should be parsed and modified. |
---|---|
String2_Expression | A substring to look up in the original string value. |
String3_Expression | A new string to use instead of the substring. |
Examples
Example1
The following example would replace the key (with CAST operator converted as string) from the Issue dimension member with an empty string. As a result, it should return the Issue dimension summary (without issue key)
Replace( [Issue].CurrentHierarchyMember.Name, Cast([Issue].CurrentHierarchyMember.Key AS STRING), "" )
Example2
The following example would replace the comma (,) with a different separator (|) when searching members from the Approvals dimension and filtering those where a current user name can be found in the members for the Approval member name.
Aggregate( Filter( [Approvals].[Approvals].Members, CurrentUserName() MATCHES Replace([Approvals].CurrentMember.GetCaption,",","|") ) )
The following code would return a user-friendly name for the "Approvals" dimension member which usually is a comma-separated string of users since this dimension is imported from a multi-user picker custom field.
[Approvals].CurrentMember.GetCaption
See also
- Function CurrentUserName to return the name for the current user who logged into eazyBI and loads the report.
- Function GetCaption to return the user-friendly name of the member.