Extract clock time from DateTime in Power BI with DAX

How to extract the time from a DateTime column in Power BI with DAX, what each method changes, and when a text label or a Power Query step is the better choice.

Pulling the clock time out of a DateTime column is one of the most common small transformations in Power BI. It sounds simple, but DAX gives you two different results depending on the method. One result is a real time value that still behaves like a number. The other is a text label that only looks like a time. This review covers what each approach actually changes, when it suits your report, and where the result stops being usable.

Short recommendation

If you need to sort, filter, bucket or calculate with the time of day, keep it as a time value. Use TIME with HOUR, MINUTE and SECOND, or subtract the date part. Then set the column's data type to Time. If you only need a fixed label for a card, tooltip or concatenated string, FORMAT is acceptable, but you give up numeric behavior. The column itself is where the tradeoff shows up. A time value stays sortable and comparable. A text label is easier to control visually but sorts as text and no longer takes part in time arithmetic.

Plain text is the better choice in a few cases: when the output feeds another system that expects a string, when you are combining the time with other words, or when locale-specific formatting must be fixed regardless of who opens the report. If the data comes from a source you control in Power Query, doing the extraction there is often cleaner than writing a DAX calculated column.

What "extract" can mean here

People searching for how to extract time from a datetime in DAX usually mean one of three things:

  • A new column that holds only the time of day as a time value.
  • A text string such as "14:37" or "2:37 PM" for display.
  • No new column at all, just a display format on the existing DateTime column that hides the date.

These differ in what is stored. The first changes the stored value: the date portion is removed. The second also changes the stored value, but turns it into a string. The third changes nothing that is stored. It is presentation only, and the full date is still there for filtering, sorting and calculations.

Method 1: TIME with HOUR, MINUTE and SECOND

Time Only =
TIME (
    HOUR ( Sales[OrderDateTime] ),
    MINUTE ( Sales[OrderDateTime] ),
    SECOND ( Sales[OrderDateTime] )
)

This rebuilds the time from its parts and returns a datetime value. DAX stores datetimes as a number in which the whole part is the date and the fractional part is the time of day. A value with no date part falls on DAX's base date, December 30, 1899. That is why the new column may show that date until you set its data type to Time in the column tools. Once the type is Time, the date portion is hidden and the column sorts chronologically.

Illustrative check: an input of 2024-03-15 14:37:22 produces a stored value equivalent to 1899-12-30 14:37:22, displayed as 14:37:22 when typed as Time. The hours, minutes and seconds carry over, and the date is discarded. This example is a worked illustration of the documented mechanism, not a measured test.

Tradeoff: SECOND returns whole seconds, so any fractional seconds in the source are dropped. If sub-second precision matters, use the subtraction method below instead.

Method 2: Subtract the date part

Time Only =
Sales[OrderDateTime] - TRUNC ( Sales[OrderDateTime] )

Because the time of day is the fractional part of the stored number, removing the whole-number part leaves only the time. INT works the same way for positive datetime values. The result is a decimal fraction of a day. Set the column's data type to Time so it displays as a clock time rather than a number such as 0.609. This method keeps whatever precision the source value holds, with no rounding to whole seconds.

Method 3: FORMAT to text

Time Label 24h = FORMAT ( Sales[OrderDateTime], "hh:mm:ss" )
Time Label 12h = FORMAT ( Sales[OrderDateTime], "h:mm AM/PM" )

FORMAT returns a string. The output looks like a time, but Power BI treats it as text. You get exact control over the appearance, including 12-hour or 24-hour style and whether seconds appear, and the label stays the same no matter how the column is typed.

The cost is behavior. Text sorts character by character. Zero-padded 24-hour strings such as "09:05" and "14:37" happen to sort in clock order. 12-hour strings do not: "10:15 AM" sorts before "2:30 AM", and AM and PM values interleave. You also cannot compare a text label to a time, add minutes to it, or put it on a continuous axis. If you need a readable label and correct sorting, keep a time-typed column alongside the label and use Sort by Column. TIMEVALUE can turn a well-formed time string back into a time value, but that adds a round trip that is usually avoidable.

Method 4: Display format only

If you only want visuals to show the time, you can apply a time-only format string to the existing DateTime column in the column tools. This is purely presentational. Slicers, filters and relationships still see the full date and time. That matters if you want to group by time of day across many dates. Two orders at 14:37 on different days remain different values, so a visual will not combine them. For time-of-day analysis, use Method 1 or 2.

Calculated column or measure

The examples above are calculated columns, which evaluate row by row. In a measure there is no single current row, so you must aggregate first, for example by applying the time extraction to MAX of the DateTime column to get the latest order's time in the current filter context. If you need to slice or group by time of day, a column is the appropriate choice. A measure cannot be used as a slicer or axis category.

Comparison

Method | Stored result | Sorts by clock order | Usable in time math | Main limit
TIME(HOUR, MINUTE, SECOND) | Time value on base date | Yes, when typed as Time | Yes | Drops fractional seconds
DateTime minus TRUNC | Fraction of a day | Yes, when typed as Time | Yes | Needs the data type set to display correctly
FORMAT | Text | Only for zero-padded 24-hour labels | No | Text sorting and locale effects
Display format only | Unchanged DateTime | By full date and time | Yes, as a full DateTime | Does not group by time of day

Readability and usability after export or sharing

Time-typed values and text labels behave differently once they leave the report. A time value carries the underlying number, so its appearance depends on the format applied by whatever displays it. A FORMAT label carries its exact characters, so it looks the same wherever it is pasted, but the destination receives a string rather than a time.

  • Locale: FORMAT follows the model's locale settings unless you pass a locale name as its optional third argument. Separators and AM/PM markers can differ between users or environments, so fix the locale if the label must be identical everywhere.
  • Time zones: none of these methods converts time zones. If the source DateTime is in UTC, the extracted time is UTC clock time. Do any conversion before extraction.
  • Export: whether an exported time column arrives in a spreadsheet as a time value or as text depends on the export path and destination. No scoped test was available for this review, so verify with your own export before relying on it.
  • Editing downstream: text labels cannot be recalculated or re-sorted chronologically in the destination without converting them back.

Accessibility: no documentation or test specific to how assistive technology reads time-typed columns versus text labels in Power BI visuals was available for this review. As a general principle, an unambiguous label such as "14:37" or "2:37 PM" is easier to interpret than an unformatted day fraction. Avoid leaving a time column untyped, where it may display as a decimal or with the 1899 base date. If your audience relies on screen readers, test the specific visuals you publish rather than assuming one rendering applies to all.

When to do it in Power Query instead

If the extraction is a fixed part of data preparation, Power Query can produce a Time-typed column before the data reaches the model. It offers a Time Only transformation and the DateTime.Time function. This keeps calculated-column logic out of the model and makes the column's type explicit at load time. DAX remains the better fit when the source is outside your control, or when the time must be derived from other calculated results.

Gaps in this review

No subject-specific measurements, version details or test results were supplied. The behavior described here reflects general, documented DAX principles: datetimes stored as numbers, FORMAT returning text, and the December 30, 1899 base date. Export results, rendering in specific destinations, and assistive technology behavior were not tested and should be checked in your own environment.