Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Seconds difference between 2 dates

Hi,

I am getting below error

Cannot convert value '04-OCT-18 02:55:46.000000000 PM' of type Text to type Date.

and I am using below Dax expression:

Gateway_Time_Diff = DATEDIFF('Test'[JMS_DELIVERED_DATE_TIME], 'Test'[FIRST_TOUCH_DATE_TIME], SECOND)

 

but when I am seleting a column in query editor it says that the column data type is Date/Time:

Capture12.PNG

 

So what approach should I take for this to gate seconds between 2 date?

 

 

1 REPLY 1
v-lili6-msft
Community Support
Community Support

hi, @Anonymous

DATEDIFF Function is dax function and in the query editor it needs M language, 

In query editor you can do these achieve your requirement

Step2:

Add a custom column that two datetime column are directly subtracted

6.JPG

Step2:

Select the result column then click Transform->date&time column->Duration->Total seconds

Result:

8.JPG

 

And the modeling process

you could create a calculate column by DATEDIFF Function

calculate column = DATEDIFF(Table1[Datetime1],Table1[datetime2],SECOND)

9.JPG

 

Best Regards,

Lin

 

 

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.