ExtractString
EAZYBI Extracts string fragment using regular expression.
Syntax
ExtractString(String_Expression, regular_expression, group)
Arguments
String_Expression | MDX expression that returns string which should be parsed using regular expression. |
---|---|
regular_expression | Regular expression string that should be used to parse string. |
group | Matched regular expression group (in parenthesis) that should be returned. If no group is specified then all matched string will be returned. |
Examples
ExtractString('Estimate:5h. Left:2h.', '.*Left:(\d+).*', 1)
will return '2'
It uses a regular expression which will match Left:
followed by one or more digits and will return this first matched group which is (\d+)
.
The formula below will extract a number of the sprint if the sprint name contains this pattern Sprint <number>, for example, Sprint 30, D1 Sprint 30, etc. The sprint number is transferred to numeric with function Val and used in comparison to the value 30.
Val(ExtractString([Sprint].CurrentMember.Name, '.*Sprint (\d+)',1)) >=30
See sample report Sprint gantt chart in our Demo account. The report has a sprint calculated member Sprints 30+ as a selection on Pages. The calculated member Sprints 30+ uses the formula above as a part of the calculation to identify sprints with number >= 30 that could be used as a sprint selection on Pages.