---
schema_version: "1"
id: d031cd5fdbd1d7249cb9ab621ee478de2cb521ae3d08d8d93ad5c4cd93724647
title: number_to_string
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_saql/guides/reference/bi-saql-functions-string-nts.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-functions-string-nts.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 2e6220de6372084f88913f044c2a11f8170d4e0d8084ffd854f8fd9ab1b84b16
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# number_to_string

Converts a number literal to a string literal.

## Syntax

`number_to_string`(_number_, _number_format_)

## Usage

Returns the string representation of _number_. Use _number_format_ to specify the format of the string, for example as currency or with two decimal places. _number_format_ can specify seperate formats for positive and negative numbers:

- `number_to_string`(_number_, _number_format_)

  The format specified by _number_format_ is used for both positive and negative numbers.

- `number_to_string`(_number_, _\<POSITIVE\>_;_\<NEGATIVE\>_)

  If _number_ is positive, the number format specified by _\<POSITIVE\>_ is used. If _number_ is negative, the number format specified by _\<NEGATIVE\>_ is used. Note the semicolon separating the two specified formats.

You can specify the format with these characters:

- 0, \#, decimal point (.)
- Thousands separator (,)
- Percentage (%)
- Leading and trailing characters: \$, +, -, (, ), :, !, ^,&,’,~,{,}

## Example

Display the number amount as a string, formatted as currency:

```nolang
q = foreach q generate 'Amount' as 'Amount', number_to_string('Amount',"$#,###.00") as 'NumberAmount';
```

![Picture of a table with a number formatted as currency.](https://developer.salesforce.com/media/bi_dev_guide_saql/bi_saql_num2string.png)

## Example

Suppose that you have a measure field with the format shown in **Number You Start With**. Use the format shown in **number_format** to display this number as a shown in **Resulting String**.

| Initial Number | number_format | Resulting String |
| -------------- | ------------- | ---------------- |
| 1234.56        | ####.#        | 1234.6           |
| 8.9            | #.000         | 8.900            |
| .631           | 0.#           | 0.6              |
| 12             | #.0#          | 12.0             |
| 1234.568       | #.0#          | 1234.57          |
| 12000          | #,###         | 12,000           |
| 12000          | #,            | 12               |
| 12200000       | 0.0,,         | 12.2             |
| 12             | 00000         | 00012            |
| 0.03457        | #.00%         | 3.46%            |
| 12.3           | $#.00;($#.00) | \$12.30          |
| -12.3          | $#.00;($#.00) | (\$12.30)        |
| 32             | +;-           | +                |
| -32            | +;-           | -                |
