cancel
Showing results for
Did you mean:
Regular Visitor

## Calculate Time to Current Time ( DAX )

Hi

I need to create DAX measurement to calculate the timing ( Timer)  from Issued time to current time.

1 ACCEPTED SOLUTION

Accepted Solutions
Super Contributor

## Re: Calculate Time to Current Time ( DAX )

The DATEDIFF function will return a number based on the difference between two times in your interval of choice.  In the below example it returns the number of Seconds, but you can chose MINUTES, HOURS, DAYS etc.

NOW() returns the current time to the second.

`Seconds = DATEDIFF([Column1],NOW(),SECOND)`

Proud to be a Datanaut!

5 REPLIES 5
Super Contributor

## Re: Calculate Time to Current Time ( DAX )

The DATEDIFF function will return a number based on the difference between two times in your interval of choice.  In the below example it returns the number of Seconds, but you can chose MINUTES, HOURS, DAYS etc.

NOW() returns the current time to the second.

`Seconds = DATEDIFF([Column1],NOW(),SECOND)`

Proud to be a Datanaut!

Regular Visitor

## Re: Calculate Time to Current Time ( DAX )

I thing sometinng worng , i tried as measure and new column

Super Contributor

## Re: Calculate Time to Current Time ( DAX )

Is Issued_date a column or a measure?

Proud to be a Datanaut!

Highlighted
Regular Visitor

## Re: Calculate Time to Current Time ( DAX )

@Phil_Seamark

Got it , its working is there any way i can make H:mm

New Contributor

## Re: Calculate Time to Current Time ( DAX )

Hi @mifrasmm,

You could try with DATEDIFF method with interval is second. after that convert to format you want: hh:mm:ss by topic

Create calculated column:

`Duration in second = DATEDIFF(Sheet1[ISSUED_DATE],NOW(),SECOND)`

```Timer = RIGHT ( "0" & INT (Sheet1[Duration in second] / 3600 ), 2 )
& ":"
& RIGHT (
"0"
& INT ( (Sheet1[Duration in second] - INT (Sheet1[Duration in second]/ 3600 ) * 3600 ) / 60 ),
2
)
& ":"
& RIGHT ( "0" & MOD (Sheet1[Duration in second], 3600 ), 2 )```

Announcements

#### Back to School Contest

Engage and empower students with Power BI!

#### Watch Sessions On Demand!

Continue your learning in our online communities.

#### Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

#### PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Top Kudoed Authors
Users Online
Currently online: 30 members 713 guests
Recent signins: