Mid
Returns a specified number of characters from a string, starting at a designated position.
Syntax
Mid(String_Expression, Numeric_Expression1 [, Numeric_Expression2])
Arguments
String_Expression | MDX expression that returns a string. |
|---|---|
Numeric_Expression1 | A numeric expression (integer) that specifies the starting position for the extraction. |
Numeric_Expression2 | A numeric expression (integer) that specifies how many characters to return from the starting position. If not specified, then all characters from the starting position will be returned. |
Examples
Sprint number
If your sprints are named in a pattern like "Project Sprint 12", you can extract the sprint number from an issue with the following formula. The measure will return the value "12".
CASE WHEN
[Measures].[Issue Sprint] <> '(no sprint)'
THEN
Mid(
[Measures].[Issue Sprint],
InStr([Measures].[Issue Sprint], 'Sprint ') + 7
)
END
Issue created time
If you wish to see at what time of the day an issue is created, you can use the following formula to extract only the time value. The starting position "12" skips the date value and the "5" specifies that only the hours and minutes should be returned, skipping seconds.
Mid(
[Issue].CurrentHierarchyMember.GetString('Created at'),
12,
5
)
See also
- Function InStr returns the position of the first occurrence of one string within another.
- Function Left returns a specified number of characters from the left side (beginning) of a string.
- Function Right returns a specified number of characters from the right side (end) of a string.