Format

Formats a number or date to a string.

Syntax

Format(Numeric_Expression, String)
Format(DateTime, String)

Arguments

Numeric_Expression
MDX expression that returns number.
DateTime
Date expression.
String

String that defines formatting of result.

For more details (and string templates) see how to Format string content.

Examples

Example below will return a version release date as a string:

  'Version release - ' || + Format([Fix Version].CurrentHierarchymember.Get('Release date'), 'Medium Date')

See example report Version report in our demo account. The calculated measure Predicted dates show several milestones on the timeline, including the version release date using the code above.


Here is another example of how to extract and show some numeric value. Example below will return a string value of Issue Name that follows after - formatted to three digits. So if the Issue name is Demo-12, the returned result would be 012.

Format(
  Val(
    ExtractString([Issue].CurrentMember.Name, 
      '.*-(\d+)', 1
    )
  ),"000"
)


See also

ExtractString and Val functions used in the example.