Dax Function: FLOOR

Category: Mathematical and Trigonometric Functions

The FLOOR function in Power BI is a DAX (Data Analysis Expressions) function that rounds a number down to the nearest multiple of a specified value. This function is commonly used in data transformations where values need to be aligned to specific thresholds or increments.

Purpose

The FLOOR function is designed to:

  1. Round a given number down to the nearest multiple of a specified value.
  2. Align numeric data to predefined ranges or intervals.
  3. Simplify numerical data for grouping, aggregation, or visualization purposes.

Type of Calculations

The function performs rounding-down operations. It ensures the result is always less than or equal to the original number, adjusted to the nearest specified multiple.

Practical Use Cases

  1. Interval Grouping: Rounding values to the nearest interval (e.g., nearest 10 or 100) for data segmentation.
  2. Financial Analysis: Aligning monetary values to standard denominations.
  3. Engineering Applications: Adjusting measurements to standard tolerances or predefined intervals.

FLOOR(<number>, <significance>)</significance></number>

ParameterTypeDescription
<number>ScalarThe numeric value to be rounded down.
<significance>ScalarThe multiple to which the <number> should be rounded down. Must be non-zero.


How Does FLOOR Dax Function Works?

The FLOOR function operates using the formula:

  • The function divides the <number> by <significance>.
  • It applies the mathematical floor operation to obtain the largest integer less than or equal to the quotient.
  • Finally, it multiplies this integer by <significance> to compute the rounded-down value.


What Does It Return?

The FLOOR function returns a numeric scalar value that represents the input <number> rounded down to the nearest multiple of <significance>.

When Should We Use It?

  • Data Aggregation: Simplify and group numerical data by specific intervals.
  • Rounding for Consistency: Ensure values conform to set increments, such as rounding prices to the nearest 5 or 10 units.
  • Preparing Data for Visualization: Standardize axes or scale intervals for better chart readability.

Examples

Basic Usage

Round a single value down to the nearest 10:


FLOOR(27,10)

Output:

20 (since 27 is rounded down to the nearest multiple of 10).

Column Usage

Apply the FLOOR function to a column of values:


FLOOR([Sales], 50)

Output: Each value in the “Sales” column is rounded down to the nearest multiple of 50.

Advanced Usage

Combine FLOOR with other DAX functions:


FLOOR(SUM([Revenue]), 100)

Output:

The sum of revenue values is rounded down to the nearest multiple of 100.

Tips and Tricks

  1. Choose Appropriate Significance: The <significance> parameter should be tailored to the dataset’s needs (e.g., 10 for whole numbers, 0.1 for decimals).
  2. Handle Edge Cases: Ensure the <significance> value is non-zero to avoid calculation errors.
  3. Combine with INT Function: Use with INT for additional control over rounding logic.

Potential Pitfalls

  • Negative Values: The function still rounds down, meaning “down” for negative numbers results in values further away from zero.
  • Non-Numeric Inputs: Ensure the <number> and <significance> are valid numeric values to avoid errors.

Performance Impact of FLOOR DAX Function:

  • Efficient on Small Datasets: FLOOR is lightweight and performs well for small to medium-sized datasets.
  • Large Datasets: For extensive datasets, consider precomputing or caching intermediate values to improve performance.

Related Functions You Might Need

  • CEILING: Rounds a number up to the nearest multiple of a specified value.
  • ROUND: Rounds a number to a specified number of digits.
  • INT: Rounds a number down to the nearest integer.
  • MROUND: Rounds a number to the nearest specified multiple (up or down).

Want to Learn More?
For more information, check out the official Microsoft documentation for FLOOR. You can also experiment with this function in your Power BI reports to explore its capabilities.

1. What does the FLOOR function do in Power BI?

The FLOOR function rounds a number down to the nearest multiple of a specified significance.

2. Can the FLOOR function handle negative numbers?

Yes, it works with negative numbers but rounds them further away from zero to the nearest multiple of the significance.

3. What happens if the significance is zero?

The FLOOR function will return an error if the significance is zero.

4. How is FLOOR different from CEILING?

While FLOOR rounds numbers down to the nearest multiple, CEILING rounds numbers up to the nearest multiple.

5. Can the FLOOR function be used with decimal values?

Yes, both the <number> and <significance> can be decimal values, enabling precise rounding.