University > Looker Studio course > FLOOR function: How to use & example

FLOOR function: How to use & example

Discover how to use the FLOOR function in Looker Studio to round numbers down to the nearest whole value. Learn syntax and practical examples.

Formulas

Introductions

The

FLOOR function in Google Data Studio is a mathematical tool wielded to fetch the closest whole number that's less than or equal to the specified value. It examines the decimal number it receives and rounds it down to the nearest whole number. This function can be beneficial in various mathematical computations or analyses involving sales metrics, profit calculations, and more.

How the Function Works

The syntax of the

FLOOR function is FLOOR(X). Here, 'X' refers to the field or expression bearing at least one field. It's crucial to remember that the output value of FLOOR(X) will be less than or equal to X. The system determines the highest integer that doesn't exceed the input number.

Examples

Let’s look at a few examples involving sales metrics to better comprehend the

FLOOR function.

Suppose your company has made a profit of $532.45 in a month, and you want to round down this number.

markdown
FLOOR(Profit)
Where Profit is the column containing the $532.45 figure.

The output will be $532, by discarding everything beyond the decimal point.

Limits of the Function

While the

FLOOR function provides a very convenient way to simplify calculations by rounding down numerical values, it has some limitations. 1. It can only be used with numerical data types; it will return an error when used with text data.2. Real numbers are converted into integers; hence, decimal values are lost.

Tips

  1. While analyzing large figures, you can use the FLOOR function to simplify numbers for a general overview or gist of the data.
  2. In comparisons involving negative figures, remember that FLOOR function brings numbers closer to negative infinity.
  3. Remember that the FLOOR function can also be used with computed fields in Google Data Studio. This can prove highly useful when you're working with computed metrics and want to round down the resultant value.
  4. Be careful with negative values as they are always rounded down. For example, FLOOR(-3.8) will give -4.

The

FLOOR function serves as a powerful tool in precise data representation and accurate calculations by eliminating the decimal complexities. Its efficient grip on numerical data sets it apart while dealing with colossal amounts of data.