Dax Function: CEILING

Category: Mathematical and Trigonometric Functions

The CEILING function in Power BI is a DAX (Data Analysis Expressions) function that rounds a number up to the nearest multiple of a specified significance. It is particularly useful for aligning numerical data to specific intervals.

Purpose

The CEILING function ensures that numbers are rounded up to a desired level of precision or interval, regardless of their fractional part. This is helpful in various scenarios like financial analysis, inventory calculations, and report formatting.

Type of Calculations

The CEILING function performs upward rounding, always rounding the input value to the nearest multiple of the specified significance. This ensures the result is greater than or equal to the original number.

Practical Use Cases

  1. Pricing and Billing: Round prices or quantities to the nearest higher multiple (e.g., nearest $0.05 or $1).
  2. Time Intervals: Align timestamps to the nearest interval, such as 5 minutes or an hour.
  3. Inventory Management: Ensure quantities are rounded up to full units for stock replenishment.
  4. Data Grouping: Segment data into fixed-size ranges.

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

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


How Does CEILING  Dax Function Works?

The CEILING function uses the following formula:

Where:

  • x is the input number.
  • s is the significance.
  •  represents the ceiling operation, which rounds up to the nearest integer.

Mathematical Example

For x=7.2 and s=2:

For x=−7.2 and s=2:


What Does It Return?

The CEILING function returns a scalar value that is the smallest multiple of the significance parameter greater than or equal to the input number.

When Should We Use It?

  • To standardize data values for analysis or reporting.
  • For aligning numerical or temporal data to predefined intervals.
  • To ensure all values meet a minimum threshold by rounding up.

Examples

Basic Usage


CEILING(7.2, 2)

Output: 8

Column Usage

Suppose you have a column [Values] containing various numbers, and you want to round each value up to the nearest multiple of 5:


= CEILING([Values], 5)

Advanced Usage

Combining CEILING with other DAX functions to calculate rounded results:


= CEILING(SUM([Sales]), 10)

This expression sums up sales values and rounds the result up to the nearest 10.

Tips and Tricks

    1. Significance Parameter: Ensure that the significance is not zero. A zero value will cause an error.
    2. Handling Negative Numbers: The CEILING function will round negative numbers upward toward zero.
    3. Consistent Rounding: Use CEILING instead of ROUNDUP when specific multiples are required.
    4. Interval Precision: Combine with the FLOOR function for flexible rounding rules.

Potential Pitfalls

  • Ensure the significance parameter aligns with your desired interval. Misaligned values may lead to unexpected results.
  • Be cautious when using negative significance, as the rounding direction might differ from expectations.

Performance Impact of CEILING DAX Function:

  • Efficient for scalar operations, but for large datasets, consider pre-aggregating or filtering data to improve performance.
  • Avoid using extremely small or large significance values, which may lead to performance degradation.

Related Functions You Might Need

  • FLOOR: Rounds a number down to the nearest multiple of significance.
  • ROUNDUP: Rounds a number up to the next largest integer.
  • MROUND: Rounds a number to the nearest multiple of a specified value, up or down.
  • ROUND: Rounds a number to a specified number of digits.

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

If you’re looking to unlock the full potential of Power BI and take your data insights to the next level, our expert Power BI consulting services are here to help. Whether you need assistance with implementing advanced DAX functions like the ones discussed here, creating interactive dashboards, or optimizing your data models for better performance, our team of seasoned Power BI consultants is ready to provide tailored solutions for your business. Visit our Power BI Consulting page to learn more about how we can empower your organization with data-driven decisions.

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

The CEILING function rounds a number up to the nearest multiple of a specified significance.

2. Can I use the CEILING function with negative numbers?

Yes, the CEILING function works with negative numbers and rounds them upward (toward zero).

3. What happens if the significance parameter is zero?

A zero significance value will cause an error. Ensure the significance is non-zero.

4. How is CEILING different from ROUNDUP?

CEILING rounds up to the nearest multiple of a specified value, while ROUNDUP rounds up to the next highest integer regardless of multiples.

 

5. Can CEILING be used with columns in Power BI?

Yes, you can apply CEILING to columns in Power BI using DAX expressions like CEILING([Column Name], 5).