Extract Time from Datetime in DAX

Compare the main DAX methods for extracting clock time from a datetime: TIME with HOUR, MINUTE and SECOND, date subtraction, FORMAT and Power Query, plus their sorting, precision and sharing tradeoffs.

Pulling the clock time out of a datetime column in DAX looks like a one-line task. The method you choose decides whether you get a real time value that sorts, groups and calculates correctly, or a piece of text that only looks like a time. This review covers the common approaches, what each one actually changes, and how the result holds up once it is copied, exported or read by someone else.

Short answer: which approach suits your use

For most models, rebuild the time with TIME, HOUR, MINUTE and SECOND in a calculated column, then set the column's data type to Time. You get a numeric value that sorts chronologically, groups by time of day and can be compared or subtracted. The main tradeoff is that this method discards fractions of a second. A calculated column also adds storage to the model, so if you control the source query, doing the extraction in Power Query is often the better place for it.

Plain text from FORMAT is the better choice only when the time is a label rather than data. Examples include a phrase inside a card title, a tooltip sentence, or an export to a system that expects a fixed string pattern. If you need to sort, filter by range or do arithmetic, text is the wrong output.

How DAX stores a datetime

DAX stores a datetime as a decimal number. The whole-number part counts days from 30 December 1899, and the fractional part is the share of a 24-hour day that has passed. Noon is 0.5 and 6:00 PM is 0.75. Extracting the time therefore means keeping only the fractional part. A time-only value still has a date underneath, and that date is 30 December 1899. This is why a time column can show that date if its format string includes one.

Method 1: rebuild the value with TIME

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

What it changes: HOUR, MINUTE and SECOND each return an integer, and TIME assembles them into a new datetime on the base date. The stored value becomes a clean fraction of a day at whole-second precision. Anything below one second is dropped. Because the components are integers, the same clock time always produces the same stored value. That makes this method safe for equality comparisons and for relationships to a time-of-day dimension table.

Method 2: subtract the date part

Order Time =
'Sales'[OrderDateTime] - INT ( 'Sales'[OrderDateTime] )

-- equivalent alternative
Order Time =
MOD ( 'Sales'[OrderDateTime], 1 )

What it changes: removing the whole-number part keeps the fractional time, including any sub-second portion. The catch is floating-point arithmetic. The remainder may differ in the last decimal places from the value TIME would produce for the same clock time. That is harmless for display and range filters, but it can cause exact matches, such as a relationship to a time table, to fail silently. If you need to join on the result, use Method 1 or round the value to the precision you need.

Method 3: FORMAT returns text

Order Time Label =
FORMAT ( 'Sales'[OrderDateTime], "hh:mm:ss" )

Order Time Label 12h =
FORMAT ( 'Sales'[OrderDateTime], "h:mm AM/PM" )

What it changes: the output is a string, not a time. It sorts alphabetically, so in a 12-hour format "10:15 AM" comes before "9:30 AM", and "01:00 PM" comes before "11:00 AM". You cannot subtract two of these values or filter them by time range. The characters produced, including separators and AM/PM markers, can depend on locale. Recent versions of DAX accept an optional locale argument for FORMAT, but check that your engine version supports it before relying on it.

Display formatting is not extraction

Power BI and similar tools let you leave the original datetime column in place and apply a time-only format string in the column properties. This changes only how the value is presented. The stored number still includes the date. A visual that groups by that column will still produce one row per distinct datetime, not one row per time of day, even if the labels look identical. Use a format string when you only want a tidier display of the full timestamp. Use an extraction method when the analysis depends on time of day alone.

Doing it upstream in Power Query

= Table.AddColumn(Source, "Order Time", each DateTime.Time([OrderDateTime]), type time)

DateTime.Time in Power Query M returns a value of type time, which loads into the model as a Time column. Doing the split here keeps calculated columns out of the model. It can also help compression, because at whole-second precision a time-only column holds at most 86,400 distinct values, while a full datetime column can have far more. If you split the original column into separate date and time columns and drop the combined one, you lose nothing you can't rebuild. No size measurements were supplied for this review, so the actual saving in a given model is untested here.

Will the result stay readable and usable after copying or sharing?

A Time-typed column carries a number. How it appears when someone copies cells from a visual or exports data depends on the tool, the format string and the receiving application. That can include the hidden base date showing up or the value arriving as a decimal. A FORMAT result copies as exactly the string you built, which is predictable. However, a receiving spreadsheet may re-parse that string as a time, or leave it as text, depending on its own locale settings. No destination-specific copy or export tests were supplied, so verify the result in the application your readers will actually use.

For readability and assistive technology, the rendered text is what gets read aloud, so the display format matters more than the stored type. Pick one convention per report, either 24-hour or 12-hour with an explicit AM/PM marker. Mixing them, or using a 12-hour format without the marker, makes times ambiguous for every reader. No screen reader testing was supplied for this review, so no claims are made about how any specific assistive tool announces these values.

A plain-text equivalent is worth having when the time is embedded in a sentence, sent to a system that expects a fixed pattern, or shown somewhere that won't apply your model's formatting. In that case, keep the numeric time column for logic and add the FORMAT column for display. In Power BI you can use Sort by Column so the text column sorts by the numeric one and stays in chronological order.

Pitfalls to check before relying on the result

  • Time zones: extraction does not convert anything, so a UTC timestamp yields a UTC clock time.
  • Blanks: DAX often treats blank as zero in arithmetic, so a missing datetime can come out as midnight. Test your data and wrap the expression in an ISBLANK check if needed.
  • Sub-second precision: Method 1 drops it, Method 2 keeps it but may carry floating-point noise, and FORMAT keeps only what the format string asks for.
  • Measures versus columns: inside a measure, the column must be wrapped in an aggregation such as MAX or SELECTEDVALUE before HOUR, MINUTE or SECOND can be applied.
  • Display format: after extraction, set a time-only format string so the base date of 30 December 1899 does not appear.

Evidence gaps

This review is based on documented, general DAX and Power Query behavior. No version-specific test results, model-size measurements or destination copy-and-paste tests were supplied. Behavior around blanks, locale handling in FORMAT and export rendering can vary between engine versions and tools, so confirm these points in your own environment before a report goes to its audience.