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.
Quando a power query tenta integrar os dados através da fonte/source SQL aparece um erro de conversão de data por parte do power bi.
É importante observar que na query do SQL não está dando problemas, eu verifiquei.
Provavelmente é quando o power bi tenta converter os dados nvarchar para data porque provavelmente a data está em formato de texto para o PBI.
Query (atual) pelo M:
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)),
1)
let Fonte = Sql.Database("serverx", "xx"), dbo_vw_PS = Fonte{[Schema="dbo",Item="dbo_vw_PS"]}[Data], CastToDate = Table.TransformColumnTypes( dbo_vw_PS, {{"DataMovimentacao", type date}}), #"Linhas Filtradas" = Table.SelectRows( CastToDate, each [DataMovimentacao] > #datetime(2019, 6, 1, 0, 0, 0)),
e segunda tentativa:
2)
let Fonte = Sql.Database("serverx", "xx"), dbo_vw_PS = Fonte{[Schema="dbo",Item="dbo_vw_PS"]}[Data], CastToDate = Table.TransformColumns( // Note we're using Table.TransformColumns instead of Table.TransformColumnTypes dbo_vw_PS, {{"DataMovimentacao", each DateTime.FromText(_, "pt-BR"), DateTime.Type}}), #"Linhas Filtradas" = Table.SelectRows( CastToDate, each [DataMovimentacao] > #datetime(2019, 6, 1, 0, 0, 0)),
Obs: esses passos acima deram problema no ciclo através da linguagem M.
Obrigado!
ADDING ENGLISH TEXT:
When the power query tries to integrate data through the source SQL, a power bi date conversion error appears. It is important to note that in the SQL query is not giving problems, I checked. This is probably when power bi tries to convert nvarchar data to date because the date is probably in PBI text format.
Hi @renanc ,
If I understand your scenario correctly that when you get the data from SQL Server Database, the date column has error ?
Normally, if the date column in SQL Server is date type, it still will be the date type when loading in power bi.
For your scenario, since the date column is identified as text type when loading in Power query, I think you could use FARMAT () function to convert the text to date.
Please refer to this thread.
Best Regards,
Cherry
Thank you @v-piga-msft for your reply.
I have posted with english body here:
https://community.powerbi.com/t5/Power-Query/Error-to-convert-nvarchar-to-Datetime/m-p/792069#M26551
But no, this thread wont solve my issue, because it is a power query problem.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.