Table of Contents
Analyzing time-series data often requires simplifying granular timestamps into manageable units. In Power BI, rounding time values to the nearest hour is a frequent necessity, enabling cleaner and more impactful visualizations. While standard rounding functions might seem appropriate, handling time formats effectively requires specific DAX logic. This guide details the precise method using the MROUND and TIME functions to achieve accurate hourly rounding.
This process ensures that timestamps are uniformly adjusted; for instance, a time like 1:25 PM is rounded down to 1:00 PM, whereas 1:35 PM is rounded up to 2:00 PM. Implementing this technique is essential for analysts aiming to create aggregated, time-based reports where high precision is less important than overall trend visibility. By controlling the aggregation level, you can generate more concise and statistically relevant insights within your Power BI dashboards.
Implementing the DAX Formula for Hourly Rounding
To successfully round a date-time column to the nearest hour, we must employ a combination of specific DAX functions. The core logic relies heavily on the MROUND function, which calculates and adjusts the time based on a specified multiple, along with the TIME function, which defines that multiple as exactly one hour.
The standard syntax for creating a calculated column that achieves this rounding is provided below. This formula is designed to work with a table named my_data and assumes the timestamp information is stored in a column titled Datetime.
Rounded Time = MROUND('my_data'[Datetime], TIME(1, 0, 0 )) + TIME(0, 0, 0)
This expression defines a new column named Rounded Time. It specifically targets the Datetime column within the table named my_data, ensuring every entry is adjusted precisely to the closest hour mark. We will now walk through a practical, step-by-step example demonstrating its application.
The following example shows how to use this syntax in practice.
Scenario Setup: Preparing Sample Data in Power BI
To illustrate the practical application of this rounding technique, we will utilize a sample dataset, labeled my_data, which records total sales alongside the exact moment those sales occurred. The primary objective is to aggregate these high-resolution timestamps into hourly buckets for easier trend analysis.
The raw data table includes a critical column, Datetime, which contains the precise time of each sale. While useful for auditing, this level of detail can often complicate visualizations meant to show overall hourly performance. Our task is to generate a derived column where every entry in Datetime is mathematically rounded to its nearest corresponding hour.

The subsequent steps detail the exact process for adding the calculated column required to perform the desired hourly aggregation within your Power BI model.
Step-by-Step Guide to Creating the Calculated Column
The procedure for applying the rounding logic involves navigating the Power BI interface and defining a new column using the DAX language. Begin by ensuring you are in the Data view or Model view, where the table structure is accessible.
First, locate the Table tools ribbon at the top of the interface. Within this tab, you will find the option to create derived data elements. Click on the icon labeled New column. This action immediately opens the formula bar, allowing you to input the necessary DAX expression.

Once the formula bar is active, type the precise formula designed for hourly rounding. This formula combines time recognition with specific mathematical functions to ensure accuracy:
Rounded Time = MROUND('my_data'[Datetime], TIME(1, 0, 0 )) + TIME(0, 0, 0)
Pressing Enter or clicking the checkmark will execute the DAX command, immediately populating the new column with the calculated, rounded time values derived from the original Datetime column.
Validating the Rounded Time Output
Upon successful execution of the formula, a new column named Rounded Time is appended to your my_data table. This column presents the results of the hourly rounding calculation, providing a clean, aggregated view of your timestamps. Reviewing the results confirms that the rounding logic operates precisely as intended, adjusting non-hourly timestamps to the closest whole hour.

To further illustrate the accuracy of the MROUND application, consider specific examples from the dataset:
- The time 10:15:00 AM, being closer to 10:00 AM than 11:00 AM, is correctly rounded down to 10:00:00 AM.
- The time 7:15:23 PM, similarly, is rounded down to 7:00:00 PM.
- The time 1:15:09 AM is successfully rounded to 1:00:00 AM.
These examples confirm that the calculated column provides the aggregated time dimension necessary for high-level temporal analysis.
Deconstructing the DAX Rounding Logic
Understanding the structure of the formula is key to adapting it for different temporal rounding requirements (e.g., rounding to the nearest 15 minutes or 30 minutes). Recall the formula we used to round each time to the nearest hour:
Rounded Time = MROUND('my_data'[Datetime], TIME(1, 0, 0 )) + TIME(0, 0, 0)
The primary function utilized here is MROUND. Since date and time values in Power BI are often represented numerically, MROUND calculates the supplied expression (the Datetime column) and rounds it to the nearest multiple defined by the second argument.
The rounding multiple is defined by TIME(1, 0, 0 ). The TIME function constructs a time value from hours, minutes, and seconds. By specifying (1, 0, 0), we instruct MROUND to round the time value to the nearest multiple of one hour. This handles the core logic of shifting any time within a half-hour window up or down to the nearest full hour.
Finally, the term + TIME(0, 0, 0) is added. While mathematically adding zero does not change the numeric value of the time, this operation is included as a best practice. Its purpose is to explicitly coerce or format the output of the calculation back into a recognizable time or datetime data type, ensuring the column displays time stamps (e.g., 10:00 AM) rather than a general serial number representing the date value.
Further Customization and Related DAX Functions
While the MROUND approach is highly effective for calculating the nearest hour, DAX provides other time manipulation functions useful for related analytical tasks. For example, if you wished to always round down (floor) to the previous hour, the FLOOR function would be appropriate. Conversely, using CEILING would always round up to the next hour.
The flexibility of defining the rounding multiple using the TIME function allows for granular control. If the requirement was to round to the nearest fifteen minutes, the multiple would be defined as TIME(0, 15, 0). This adaptability makes the MROUND technique a powerful tool for various temporal data aggregation needs.
For in-depth reference on optimizing your Power BI model and mastering calculated fields, consult the official documentation regarding the new column feature and related temporal functions. Mastery of these functions is crucial for generating high-performance dashboards that accurately reflect underlying business processes.
Related Power BI Tutorials
The following tutorials explain how to perform other common tasks in Power BI:
- How to Calculate the Difference Between Two Dates Using DAX.
- Creating Custom Date Hierarchies for Advanced Filtering.
- Using Parameters to Dynamically Adjust Time Granularity.
Cite this article
mohammed looti (2026). How to Round Time to the Nearest Hour in Power BI. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-round-time-to-the-nearest-hour-in-power-bi/
mohammed looti. "How to Round Time to the Nearest Hour in Power BI." PSYCHOLOGICAL SCALES, 10 Jan. 2026, https://scales.arabpsychology.com/stats/how-can-i-round-time-to-the-nearest-hour-in-power-bi/.
mohammed looti. "How to Round Time to the Nearest Hour in Power BI." PSYCHOLOGICAL SCALES, 2026. https://scales.arabpsychology.com/stats/how-can-i-round-time-to-the-nearest-hour-in-power-bi/.
mohammed looti (2026) 'How to Round Time to the Nearest Hour in Power BI', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-round-time-to-the-nearest-hour-in-power-bi/.
[1] mohammed looti, "How to Round Time to the Nearest Hour in Power BI," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, January, 2026.
mohammed looti. How to Round Time to the Nearest Hour in Power BI. PSYCHOLOGICAL SCALES. 2026;vol(issue):pages.
