Matches
MATCHES and NOT MATCHES are Mondrian-specific functions that compare a string with a regular expression or another string expression. For example, compare the dimension member name with the specific string.
Syntax
String_Expression MATCHES Regular_expression
Arguments
String_Expression | any string (including regular_expressions) |
---|---|
Regular_expression | pattern that the regular expression engine attempts to match in the input text |
Examples
Returns True if the particular member from the "Week day" dimension has a name that matches Saturday or Sunday
[Week Day].CurrentHierarchyMember.Name NOT MATCHES 'Saturday|Sunday'
Returns True if the particular user from Assignee in the report has a name that does not start with John (incl. JOHN, john, etc). Note, that NOT can be used also at the beginning.
NOT [Assignee].CurrentHierarchyMember.Name MATCHES '^(?i)john.*'
Counts filtered set of issues from the "Issue" dimension at the "issue" level, where the property "Issue labels" matches the string "test"
Count( Filter( DescendantsSet([Issue].CurrentHierarchyMember, [Issue].[Issue]), [Measures].[Issue labels] MATCHES '.*test.*' ) )
If the text value you wish to match contains special characters, you must escape them by adding a single backslash "\" before each special character.
For example, if you wish to match the following text: "Sales ($1M-$10M)", you would need to escape the following characters: (
, )
, and $
.
[Measures].[Sales amount] MATCHES 'Sales \(\$1M-\$10M\)'
See also
- Function DescendantsSet() to descend into another dimension
- Function Filter() to filter set of issues