DAX Function Guide

SECOND
Empty image or helper icon

Sam McKay

CEO & Founder

How does the SECOND work?
The SECOND function (DAX) returns the seconds of a time value, as a number from 0 to 59.
SECOND Formula Syntax

SECOND (
     <time>
)

How do you use the SECOND?

The SECOND function returns the second component of a time as a number between 0-59. For example, with a time of 9:10:15 AM, second will return 15. You can use the SECOND function to extract the second into a cell, or feed the result into another formula, like the TIME function.

Related Blog Posts

Loading

Considerations when using the SECOND?

In contrast to Microsoft Excel, which stores dates and times as serial numbers, DAX uses a datetime format when working with dates and times. If the source data is not in this format, DAX implicitly converts the data. You can use formatting to display the dates and times as a serial number of you need to.

The date/time value that you supply as an argument to the SECOND function can be entered as a text string within quotation marks (for example, “6:45 PM”). You can also provide a time value as the result of another expression, or as a reference to a column that contains times.

If you provide a numeric value of another data type, such as 13.60, the value is interpreted as a serial number and is represented as a datetime data type before extracting the value for seconds. To make it easier to understand your results, you might want to represent such numbers as dates before using them in the SECOND function. For example, if you use SECOND with a column that contains a numeric value such as, 25.56, the formula returns 24. That is because, when formatted as a date, the value 25.56 is equivalent to January 25, 1900, 1:26:24 PM.

When the time argument is a text representation of a date and time, the function uses the locale and date/time settings of the client computer to understand the text value in order to perform the conversion. Most locales use the colon (:) as the time separator and any input text using colons as time separators will parse correctly. Review your locale settings to understand your results.

Related Video Tutorials

Loading

Formula examples using the SECOND

=SECOND(‘Orders'[TransactionTime])

=SECOND(“March 3, 2008 12:00:03”)

=SECOND(“4:30:24 AM”)

Related Courses

Loading