Power BI DAX SECOND

The Power BI SECOND function is one of the DAX Date and Time functions used to return the Second numbers from 0 to 59 from the given DateTime. This article explains the POWER BI DAX SECOND function that accepts the time value and returns integer from 0 to 59 and the syntax is shown below:

SECOND(<time>)

The SECOND function takes the time value as the argument and extracts the Second part from it. The argument can be a time, datetime, or the expression that returns or is implicitly convertible to the datetime. 

  • If you provide the time (“10:30:45 AM”) as the argument, the Power BI DAX SECOND function extracts the result. 
  • If you use the number value as an argument, first convert to datetime and then use the SECOND function. Otherwise, you will confuse with the result.
  • When the time argument is the text representation of the datetime, the SECOND function uses the local date and time settings to understand a text value.

Power BI DAX SECOND function Example

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

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

Seconds = SECOND(NewEmployee[HireDate])

POWER BI DAX SECOND Function

You can create a bar chart to show the Seconds-wise sales (the sum of the sales by the employees hired in Seconds ). To do so, use the Power BI DAX Second function resullt on the X-Axis and the Sales or profit on the Y-Axis.

In real-time, if you replace the HireDate with OrderDate, you get which Second drives the highest sales. For the remaining charts, visit the Power BI Charts article.