Skip to main content

Number Format

Note

To apply Number Format for your dimension/measure, ensure its type is number.

Overview of Number Format

To format your number fields, add a format property with a string pattern representing your chosen format.

dimension formatted_price {
label: "Formatted Price"
type: "number"
format: "#,###[$$]"
}
Demostration for raw and formatted values

Shorthand Syntax vs. Full Syntax

Normally, you would use the shorthand version, which is represented as a string pattern under the format field. However, if you want more control over your formats, consider using the full syntax instead as it offers additional options to choose from.

Shorthand format example

dimension price {
label: "price"
type: "number"
description: "This dimension is using the shorthand format syntax"
format: "[$$]#,###"
}

Full format example

dimension price {
label: "price"
type: "number"
description: "This dimension is using the full number format syntax"
format: FullNumberFormat {
pattern: '[$$]#,###0.00,,"\M"'
// There are more options to choose from!
groupSeparator: " "
decimalSeparator: "."
}
}

Order for Number Format

The number format follows the order below.

Order for Number Format

Available Number Format options

currency (optional)

Note

abbreviation/currency cannot be used with percentage.

Syntax:

 [$<currency code>]

Description:

  • The currency notation must be wrapped in [$<insert_your_currency_here>].

  • The currency notation can only be placed in one of these places:

    • At the beginning of the string pattern.
    • At the end of the string pattern.
  • Currently, we only support these currency types:

    '$' //'($) US Dollar / MEX Peso'
    '€' //'(€) Euro'
    '¥' //'(¥) Yen'
    '£' //'(£) Pound'
    '元' //'(元) Renminbi'
    '₺' //'(₺) Lira'
    '₩' //'(₩) Won'
    '₽' //'(₽) RUS Ruble'
    '₹' //'(₹ ) IND Rupee'
    '₨' //'(₨) PAK Rupee'
    '₱' //'(₱) PHL Peso'
    'A$' //'(A$) AUS Dollar'
    'C$' //'(C$) CAN Dollar'
    'S$' //'(S$) SGP Dollar'
    'NZ$' //'(NZ$) NZ Dollar'
    'HK$' //'(HK$) HK Dollar'
    '₪' //'(₪) Shekel'
    'R$' //'(R$) Real'
    '฿' //'(฿ )) Thai Baht'
    'R' //'(R) South African Rand'
    'Fr' //'(Fr) Franc'
    'kr' //'(kr) Krona / Krone'
    'Ft' //'(Ft) Forint'
    'Rp' //'(Rp) Rupiah'
    'RM' //'(RM) Ringgit'
    'VND' //'(VND) VN Dong'
    'Tk' //'(Tk) BGD Taka'

Example:

Raw ValueNumber PatternDisplayed as
54[$$]#,###$54
1236#,###[$€]1,236€

group separator for integer values (optional)

Note

Holistics will automatically apply thousands separator for integers whether you specify this option or not.

Syntax:

#,###

Description:

  • Use this pattern to specify a group separator for your integer values. Currently, we only support thousands separator.
  • The default separator is a comma (,). To specify another separator, refer to Full Format: Custom Group Separator.

Example:

Raw ValueNumber PatternDisplayed as
586347#,###586,347
1234#,###1,234
23431#,###23,431

fraction (optional)

0.0 (add more 0 if more decimal places are needed)

Description:

Example:

Raw ValueNumber PatternDisplayed as
123456789.01230.00123456789.01

percentage (optional)

Note

abbreviation/currency cannot be used with percentage.

Syntax:

% or \\%

Description:

  • % converts a number to percentage format by multiplying the original value by 100.
  • \\% converts a number to percentage format without modifying the original value. Example:
Raw ValueNumber PatternDisplayed as
12.3456#,###0.0%1,234.6%
#,###0.0\%12.4%

abbreviation (optional)

Note

abbreviation/currency cannot be used with percentage.

Syntax:

,"K" or ,,"M" or ,,,"B"

Description:

  • If your string pattern is wrapped in single quotes (’ ‘), you will not need to to wrap your abbreviation with escape characters(\ \). For example, this is a valid pattern: format: '<other_format_part>,"K"'
  • If your string pattern is wrapped in double quotes (” “), you will have to wrap your abbreviation with escape characters(\ \). For example, this is a valid pattern: format: "<other_format_part>,\"K"\"
  • Abbreviate long numeric value:
    • ,"K" for thousand
    • ,,"M" for million
    • ,,,"B" for billion

Example:

Raw ValueNumber PatternDisplayed as
124412.4'#,###0.000,,"M"'0.124M
157698'#,###0.000,,"M"'0.158M

Additional options for Full Syntax Number Format

To use these options, specify your Number Format in Full Syntax form.

groupSeparator

This option allows you to select a custom separator for your integer values.

Syntax:

format: FullNumberFormat {
pattern: "#,###"
groupSeparator: ","
}

Description:

  • By default, the group separator for integer values is a comma ,. To opt for another separator, add this option in your format field.
  • Selectable separators include:
    • ",": comma separator (default)
    • " ": space separator
    • ".": dot separator Example:
Raw ValueNumber PatternDisplayed as
543213groupSeparator: “ “534 213
12345,1groupSeparator: “,“12,345.1

decimalSeparator

This option allows you to select a custom separator for your decimal values.

Syntax:

format: FullNumberFormat {
pattern: "0.00"
decimalSeparator: "."
}

Description:

  • By default, the group separator for decimal values is a dot .. To opt for another separator, add this option in your format field.
  • Selectable separators include:
    • ".": dot separator (default)
    • ",": comma separator

Example:

Raw ValueNumber PatternDisplayed as
54,123decimalSeparator: “.“54.123

Let us know what you think about this document :)