You might require your numeric data to be formatted in a certain manner as you work with your dataset. For example, you might need a Price field to contain upto two decimal digits, or need to add the % symbol to a Discount field. You can use the NUMFORMAT transform for this type of number formatting.
Using NUMFORMAT Transform
In the top Search box, enter 'Numformat' and search. Select the resulting NUMFORMAT option.
This transform converts the value you provide to a custom number format.
Value - Can be any value you want to convert - it can be a column containing numbers, a function returning numbers or a number you specify.
Format - Is a string representing the format you want to convert into. You can use # to represent digits that exist in your value.
In general, you should format your numeric data after you have completed your computations on it. In some cases, you might lose numeric precision in converting formats, or your data can be re-typed to a different data type.
Example 1 - Display number to 2 significant digits
In the use case shown, we will change the format of the Price field from an integer to price tag, with 2 decimal points, ie. "$###.00" , as shown in the Preview.
The output returns the values from the Price column converted to our specified price format.
The transform also changes the data type of the column from Integer to String due to the '$' character
Missing values for this function in the source data result in missing values in the output.
Example 2 - Display decimal as integer
Here we wanted to have our Ticket_Price in whole numbers without the decimal, so we have used NUMFORMAT to return us an integer value ("#")
The output returns values from Ticket_Price column as whole numbers, rounded off to the nearest integer and dropping the decimal digits
The data type changes from Decimal to Integer
Note- This function just changes how the underlying cell value is displayed. If you round the value to a specific level of precision, please use the ROUND function.
To learn more about this transform, read this detailed documentation guide.