Mathematical Functions you should know in BigQuery

How to Work with Numbers in BigQuery

Christianlauer
Geek Culture

--

Photo by Jeswin Thomas on Unsplash

Google’s BigQuery offers a whole range of math functions you can use — check here for more info. However, in my opinion there are a few functions that you really use often and need frequently especially in analytics and dashboarding. Maybe these will help you with your next project.

IS_NAN

Firstly, there would be the function IS_NAN(). This helps you to check if the value you want to calculate is a valid number or a NaN (Not a Number).

IS_NAN(9)

So in this example we would get back a false.

GREATEST

This function helps you to find the largest value from a number series.

Select GREATEST(1,2,3,4,5)

The result would be 5.

LEAST

As above only with the smallest number.

Select Least(1,2,3,4,5)

Here, we would get 1 as the result.

ROUND

If only X is present, ROUND rounds X to the nearest integer. If N is present, ROUND rounds X to N decimal places after the decimal point [3].

Select Round(2,3)

--

--

Christianlauer
Geek Culture

Big Data Enthusiast based in Hamburg and Kiel. Thankful if you would support my writing via: https://christianlauer90.medium.com/membership