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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
afinman
New Member

DateDiff and NOW do not work

I have an increasingly frustrated with PowerBI

 

I have many tables with DateTime values in from SQL Server. I want to do DateDiff functions on these in PowerBI comparing to NOW() so I can get Days/Hours/Minutes since these dates, but PowerBI just gets upset and errors:

 

I have had to resort to creating views in the database to do this which seems silly. I have been playing this morning and note that when I do StartedMinutesAgo = DATEDIFF(NOW(), ProbeRun[StartTime], MINUTE) it fails, but If I do StartedMinutesAgo = DATEDIFF("2017-01-01", ProbeRun[StartTime], MINUTE) it works fine which presumably means it is unhappy with the output of NOW() and TODAY() rather than the data in my database tables.

 

The error is


The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.. The exception was raised by the IDataReader interface.

 

HELP!

 

1 ACCEPTED SOLUTION
v-chuncz-msft
Community Support
Community Support

@afinman,

 

As shown in the error message, the data type is nvarchar and can not be automatically converted to datetime for the current date/time settings. You'll need to perform explicit conversion accordingly.

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

View solution in original post

3 REPLIES 3
v-chuncz-msft
Community Support
Community Support

@afinman,

 

As shown in the error message, the data type is nvarchar and can not be automatically converted to datetime for the current date/time settings. You'll need to perform explicit conversion accordingly.

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

I have an increasingly frustrated with PowerBI

 

I have many tables with DateTime values in from SQL Server. I want to do DateDiff functions on these in PowerBI comparing to NOW() so I can get Days/Hours/Minutes since these dates, but PowerBI just gets upset and errors:

 

I have had to resort to creating views in the database to do this which seems silly. I have been playing this morning and note that when I do StartedMinutesAgo = DATEDIFF(NOW(), ProbeRun[StartTime], MINUTE) it fails, but If I do StartedMinutesAgo = DATEDIFF("2017-01-01", ProbeRun[StartTime], MINUTE) it works fine which presumably means it is unhappy with the output of NOW() and TODAY() rather than the data in my database tables.

 

The error is


The conversion of a nvarchar data type to a datetime data type resulted in an out-of-range value.. The exception was raised by the IDataReader interface.

 

HELP!

 

I have just found that the relative search for dates/times errors with the same issue.

Am wonderinf if this is a locale issue with PowerBI and SQL...

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.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

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.