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 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"
)

Example below will return Issue creation date proceeded with the name of day of week, like, Friday, Jul 27 2018.

Format(
  [Measures].[Issue created date],
  'dddd, mmm dd yyyy'
)

See also

ExtractString and Val functions that are used in the example.