14 May 20 · npack · #Bigquery ·   Bookmark   ×

How to trim and display only 4 digits / decimal places in Bigquery Numeric ?

BigQuery supports a FORMAT() function for formatting strings. This function is similar to the C printf function. It produces a STRING from a format string that contains zero or more format specifiers, along with a variable length list of additional arguments that matches the format specifiers

Select FORMAT("%.*f",2,Col_Name) from Mydataset.MyTable;


Select Format("%.*f",2,98.30000):

Returns: 98.30

Also see:

Roundup decimals in Bigquery
Truncate decimals in Bigquery


posted on 14 May 20

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds