Редактиране

Споделяне чрез


Format numbers and dates in Report Builder paginated reports

Applies to:  Microsoft Report Builder (SSRS)  Power BI Report Builder  Report Designer in SQL Server Data Tools

You can format numbers and dates in data regions in a paginated report by selecting a format from the Number page of the corresponding data region's Properties dialog box.

To specify format strings within a text box report item, you need to select the item that you want to format, right-click, select Text Box Properties, and then select Number. You can format individual cells in a table or matrix data region in the same manner, because cells in a table or matrix are individual text boxes.

A chart data region commonly shows dates along the category (x) axis and values along the value (y) axis. To specify formatting in a chart, right-click an axis and select Axis Properties. On the value axis, you can specify formats only for numbers. For more information, see Format axis labels on a paginated report chart (Report Builder).

To specify formatting in a Gauge data region, right-click the scale of the gauge and select Radial Scale Properties or Linear Scale Properties.

Note

If some formatting options you want to use are grayed out, it means that those formatting options aren't compatible with the field's data type, which is set in the data source. For example, if the field contains number values but the field's data type is String, you can't apply numerical data formatting options such as currency or decimals.

Note

You can create and modify paginated report definition (.rdl) files in Microsoft Report Builder, Power BI Report Builder, and in Report Designer in SQL Server Data Tools.

Considerations for formatting numbers and dates

Before you format numbers and dates in your report, consider the following details:

  • By default, numbers are formatted to reflect the cultural settings on the client computer. Use formatting strings to specify how numbers display so that formatting is consistent regardless of where the person who is viewing the report is located.

  • The formats provided on the Number page are a subset of the .NET Framework standard numeric format strings. To format a number or date using a custom format that isn't shown in the dialog box, you can use any .NET Framework format strings for numbers or dates.

  • If a custom format string is specified, it has a higher priority over default settings that are culture-specific. For example, suppose you set a custom format string of "#,###" to show the number 1234 as 1,234. This format might have different meaning to users in the United States than it does to users in Europe. Before you specify a custom format, consider how the format you choose affects users of different cultures who might view the report.

  • If you specify an invalid format string, the formatted text is interpreted as a literal string, which overrides the formatting.

  • If you format a mix of numbers and characters in the same text box, consider the use of a placeholder to format the number separately from the rest of the text. For more information, see Format text and placeholders in paginated reports (Report Builder). If an invalid format string is specified for the Format property on the text box, the format string is ignored. If you specify an invalid format string for the Format property on the chart or gauge, the format string that you specify is interpreted as a string. Then formatting isn't applied.

  • If you select Currency under Category, and you check Show values in, you can select Thousands, Millions, or Billions to display numbers that use financial formats. For example, if the field value is 1,789,905,394 and you select Billions and specify 2 decimal places, the value displayed in the report is 1.78.