Component.DecimalPlaces
Returns format string with specified number of decimal places. Adds decimal places to format strings.
Syntax
DaxLib.FormatString.Component.DecimalPlaces ( base_format, decimal_places )
Definition
DAX
// Returns a 0 string repeated a number of times equal to the number of decimal places
(
// Base format string
// Expects a valid format string base, i.e. "#,##0"
base_format: STRING,
// Number of decimal places
// Expects an integer value from 0-9
decimal_places: INT64
)
=>
base_format
&
IF (
decimal_places > 0,
"."
& REPT ( "0", MIN ( decimal_places, 9 ) ),
""
)
Parameters
| Parameter | Type | Description |
|---|---|---|
base_format |
STRING | Base format string (e.g., "#,##0") |
decimal_places |
NUMBER | Number of decimal places (0-9) |
Example
DaxLib.FormatString.Component.DecimalPlaces ( "#,##0", 2 )
Use this function to add decimal places to a base format string.
Related Functions
- Basic.Numbers - Basic number formatting
- Basic.Temperature - Temperature formatting with decimal places