Power BI DAX HOUR

The Power BI HOUR function is one of the DAX Date and Time functions used to extract and return the hour numbers from 0 (midnight) to 23 (11 PM)from the given DateTime. This article explains the POWER BI DAX HOUR function that accepts the datetime value and returns an integer from 0 to 23 and the syntax is shown below:

HOUR(<datetime>)

The HOUR function takes the time value as the argument and extracts the hour part from it. The argument can be a time, a combination of date and time, direct input of time, or the expression that returns the datetime. If you provide the text representation of the datetime as the argument, the DAX HOUR function uses the local computer date/time settings to read the value.

Power BI DAX HOUR function Example

To demonstrate the DAX HOUR() function, we use the HireDate column from the NewEmployee table that has 15 records. To extract the Hour for each row, we need a new column. So, go to the Modeling Tab, click the New Column button, and rename it as Hours to obtain hours from the hire date. Please refer to the DAX MINUTE and DAX SECOND functions.

Next, please add the new Hours column to the table report. Please refer to the list of Power BI DAX Date functions and the Power BI DAX functions article available on the Power BI tutorial page for the remaining methods.

Hours = HOUR(NewEmployee[HireDate])
POWER BI DAX HOUR Function 1

You can create a bar chart to show the hourly sales (sum of the sales by the employees hired hours). To do so, place Hours in the X-Axxis and Sales on the Y-Axis. In real-time, if you replace the HireDate with OrderDate, you get which hour is performing great. For the remaining charts, visit the Power BI Charts article.