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.
Value |
---|
7.8 |
3.2 |
9.6 |
5.1 |
To round down the "Value" column to the nearest whole number using the FLOOR
function, you can create a calculated field in Tableau:
- Right-click on a blank area in the "Data" pane in Tableau.
- Select "Create Calculated Field."
- In the formula editor, enter the following expression:
FLOOR([Value])
- 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:
Value | Rounded Value |
---|---|
7.8 | 7 |
3.2 | 3 |
9.6 | 9 |
5.1 | 5 |
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