A
C
- CALCULATE
- CALCULATETABLE
- CALENDAR
- CALENDARAUTO
- CEILING
- CHISQ.DIST
- CHISQ.DIST.RT
- CHISQ.INV
- CHISQ.INV.RT
- CLOSINGBALANCEMONTH
- CLOSINGBALANCEQUARTER
- CLOSINGBALANCEYEAR
- COALESCE
- COLUMNSTATISTICS
- COMBIN
- COMBINA
- COMBINEVALUES
- CONCATENATE
- CONCATENATEX
- CONFIDENCE.NORM
- CONFIDENCE.T
- CONTAINS
- CONTAINSROW
- CONTAINSSTRING
- CONTAINSSTRINGEXACT
- CONVERT
- COS
- COSH
- COT
- COTH
- COUNT
- COUNTA
- COUNTAX
- COUNTBLANK
- COUNTROWS
- COUNTX
- COUPDAYBS
- COUPDAYS
- COUPDAYSNC
- COUPNCD
- COUPNUM
- COUPPCD
- CROSSFILTER
- CROSSJOIN
- CUMIPMT
- CUMPRINC
- CURRENCY
- CURRENTGROUP
- CUSTOMDATA
D
E
I
N
O
P
R
S
- SAMEPERIODLASTYEAR
- SAMPLE
- SEARCH
- SECOND
- SELECTCOLUMNS
- SELECTEDMEASURE
- SELECTEDMEASUREFORMATSTRING
- SELECTEDMEASURENAME
- SELECTEDVALUE
- SIGN
- SIN
- SINH
- SLN
- SQRT
- SQRTPI
- STARTOFMONTH
- STARTOFQUARTER
- STARTOFYEAR
- STDEVX.P
- STDEVX.S
- STDEV.P
- STDEV.S
- SUBSTITUTE
- SUBSTITUTEWITHINDEX
- SUM
- SUMMARIZE
- SUMMARIZECOLUMNS
- SUMX
- SWITCH
- SYD
T
U
What is the HOUR function in Power BI?
The HOUR function in Power BI is a DAX function that extracts the hour value from a datetime or time column. It returns an integer value between 0 and 23, representing the hour of the day.
Syntax of the HOUR function
The syntax of the HOUR function is as follows:
HOUR(❰datetime❱)
The ❰datetime❱ argument is a reference to a datetime or time column from which you want to extract the hour value.
Example of using the HOUR function
Suppose you have a datetime column called "OrderDate" in your data model, and you want to extract the hour value from it. You can use the HOUR function as follows:
= HOUR(Orders[OrderDate])
This will return an integer value representing the hour of the day for each row in the "OrderDate" column.
Using the HOUR function with other DAX functions
The HOUR function can be used in combination with other DAX functions to perform more complex calculations. For example, you can use the HOUR function with the SUMX function to calculate the total sales for each hour of the day.
= SUMX(Orders, IF(HOUR(Orders[OrderDate]) = 10, Orders[Sales], 0))
This formula will calculate the total sales for the 10th hour of the day.
Using the HOUR function with conditional statements
You can also use the HOUR function with conditional statements to filter your data based on the hour value. For example, you can use the HOUR function with the FILTER function to filter your data to show only the orders that were placed between 9 AM and 5 PM.
= FILTER(Orders, AND(HOUR(Orders[OrderDate]) ❱= 9, HOUR(Orders[OrderDate]) ❰= 17))
This formula will filter the "Orders" table to show only the orders that were placed between 9 AM and 5 PM.
The HOUR function in Power BI is a useful tool for extracting the hour value from a datetime or time column. It can be used in combination with other DAX functions and conditional statements to perform more complex calculations and filter your data based on the hour value. By using the HOUR function, you can gain valuable insights into your data and make better-informed business decisions.