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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors