Thursday, June 22, 2023

Explain the Number Function ' FLOOR ' in Tableau with Example?

 In Tableau, the FLOOR function is a number function that rounds a given number down to the nearest integer or specified decimal place. It returns the largest integer that is less than or equal to the specified number.

The syntax for the FLOOR function in Tableau is as follows:

FLOOR(number, [decimal_place])
  • number is the numeric value that you want to round down.
  • [decimal_place] is an optional parameter that specifies the decimal place to which you want to round down. If not provided, the default value is 1, which rounds down to the nearest whole number.

Here's an example to illustrate the usage of the FLOOR function in Tableau:

Suppose you have a dataset with a column called "Value" that contains different numeric values.


To round down the "Value" column to the nearest whole number using the FLOOR function, you can create a calculated field in Tableau:

  1. Right-click on a blank area in the "Data" pane in Tableau.
  2. Select "Create Calculated Field."
  3. In the formula editor, enter the following expression:

  1. Click "OK" to create the calculated field.

The calculated field, which utilizes the FLOOR function, will round down each value in the "Value" column to the nearest whole number.

The resulting dataset will be as follows:

ValueRounded Value

In this example, the FLOOR function rounds down each value in the "Value" column to the nearest whole number. For instance, 7.8 is rounded down to 7, 3.2 is rounded down to 3, and so on.

You can also specify a decimal place parameter with the FLOOR function to round down to a specific decimal place. For example, FLOOR([Value], 1) would round down to the nearest tenth (one decimal place). So if the "Value" column contained 7.8, it would be rounded down to 7.8.

The FLOOR function is useful when you need to round down numeric values to integers or specific decimal places. It can be used in various scenarios, such as truncating decimal values, calculating intervals, or grouping data.

No comments:

Post a Comment

If you have any doubts. Please let me know

How can you create an alias for a table in a SQL query?

In SQL, you can create an alias for a table in a query to give the table a temporary, alternative name that you can use in the query. Table ...