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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
renanc
Helper II
Helper II

Error to convert nvarchar to Datetime

When the power query tries to integrate data through the SQL source, a power bi date conversion error appears. It is important to note that the SQL query is not giving problems, I checked in SQL software.
This is (probably) when power bi tries to convert nvarchar data to date because the date is (probably) in PBI text format.

 

Conversion errorConversion errorSQL table/query sourceSQL table/query source

(Table) - Source from power query: 

Fonte = Sql.Database("serverx", "xx"),
dbo_vw_PS = Fonte{[Schema="dbo",Item="dbo_vw_PS"]}[Data],
#"Linhas Filtradas" = Table.SelectRows(ddbo_vw_PS, each [DataMovimentacao] > #datetime(2019, 6, 1, 0, 0, 0)),

 

2 ACCEPTED SOLUTIONS
AnkitBI
Solution Sage
Solution Sage

Is your Date in SQL stored as NVarchar ? Also, share some sample data, may be just dates from SQL

View solution in original post

v-juanli-msft
Community Support
Community Support

Hi @renanc 

Could you show me the date format in SQL Database?

Maybe we need do some transformation for the date column.

 

There are some similar thread you could refer to

https://community.powerbi.com/t5/Desktop/Microsoft-Sql-converting-data-type-varchar-10-to-int-only-i...

 

 

Best Regards
Maggie
Community Support Team _ Maggie Li
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

4 REPLIES 4
v-juanli-msft
Community Support
Community Support

Hi @renanc 

Could you show me the date format in SQL Database?

Maybe we need do some transformation for the date column.

 

There are some similar thread you could refer to

https://community.powerbi.com/t5/Desktop/Microsoft-Sql-converting-data-type-varchar-10-to-int-only-i...

 

 

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

 

@v-juanli-msft  the issue was solved, the problem was indeed inside a SQL account view (the one linked in power bi) whose didnt have the correct datetime in english to portuguese.

In one of the sql accounts the table was loading properly, so we checked and converted to the same datetime and worked (that's why I said in SQL was ok, because indeed it was, but not in the one which was linked with BI).

Lol.. thank you guys, and sorry to waste your time, the whole issue was rooted in SQL.

AnkitBI
Solution Sage
Solution Sage

Is your Date in SQL stored as NVarchar ? Also, share some sample data, may be just dates from SQL

@AnkitBI the issue was solved, the problem was indeed inside a SQL account view (the one linked in power bi) whose didnt have the correct datetime in english to portuguese.

In one of the sql accounts the table was loading properly, so we checked and converted to the same datetime and worked (that's why I said in SQL was ok, because indeed it was, but not in the one which was linked with BI).

Lol.. thank you guys, and sorry to waste your time, the whole issue was rooted in SQL.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.