Valor de Microsoft.OleDb.Date: problemas con la fecha de tipo de columna con R

Un usuario Pregunto ✅

smpa01

Hola expertos,

Cada vez que tengo una columna de fecha en mi conjunto de datos en la que ejecuto un script R, devuelve un valor extraño.

Por ejemplo, estas dos líneas

Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtA1NNI1MlXSUTI0MFCK1YEJGuoaGQAFjVAEgcgCKGgMEowFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Integer = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Integer", Int64.Type}})

devoluciones

Fecha Entero
25/12/2020 100
20/11/2020 200
18/10/2020 300

Si escribo dos líneas más de R

#"Run R script" = R.Execute("https://community.powerbi.com/t5/Desktop/Microsoft-OleDb-Date-value-Issues-with-column-type-date-with-R/td-p/#"dataset' holds the input data for this script#(lf)x<-data.frame(dataset)",[dataset=#"Changed Type"]),
    #"""x""" = #"Run R script"{[Name="x"]}[Value]
in
    #"""x"""

se convierte en esto

Fecha Entero
Microsoft.OleDb.Date 100
Microsoft.OleDb.Date 200
Microsoft.OleDb.Date 300

Todo el guión está siguiendo

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtA1NNI1MlXSUTI0MFCK1YEJGuoaGQAFjVAEgcgCKGgMEowFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Integer = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Integer", Int64.Type}}),
    #"Run R script" = R.Execute("https://community.powerbi.com/t5/Desktop/Microsoft-OleDb-Date-value-Issues-with-column-type-date-with-R/td-p/#"dataset' holds the input data for this script#(lf)x<-data.frame(dataset)",[dataset=#"Changed Type"]),
    #"""x""" = #"Run R script"{[Name="x"]}[Value]
in
    #"""x"""

Beyond base RI también probó otras bibliotecas y siempre devuelve lo mismo.

Por ejemplo, con data.table

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtA1NNI1MlXSUTI0MFCK1YEJGuoaGQAFjVAEgcgCKGgMEowFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Integer = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Integer", Int64.Type}}),
    #"Run R script" = R.Execute("https://community.powerbi.com/t5/Desktop/Microsoft-OleDb-Date-value-Issues-with-column-type-date-with-R/td-p/#"dataset' holds the input data for this script#(lf)library(data.table)#(lf)x<-data.table(dataset)",[dataset=#"Changed Type"]),
    #"""x""" = #"Run R script"{[Name="x"]}[Value]
in
    #"""x"""

Me está dando un mal rato. ¿Alguien sabe cómo depurar esto, por favor?

Gracias de antemano.

smpa01

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtA1NNI1MlXSUTI0MFCK1YEJGuoaGQAFjVAEgcgCKGgMEowFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Integer = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type text}, {"Integer", Int64.Type}}),
    #"Run R script" = R.Execute("https://community.powerbi.com/t5/Desktop/Microsoft-OleDb-Date-value-Issues-with-column-type-date-with-R/td-p/#"dataset' holds the input data for this script#(lf)library(data.table)#(lf)x<-data.table(dataset)",[dataset=#"Changed Type"]),
    #"""x""" = #"Run R script"{[Name="x"]}[Value],
    #"Changed Type1" = Table.TransformColumnTypes(#"""x""",{{"Date", type date}})
in
    #"Changed Type1"

smpa01

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjIwMtA1NNI1MlXSUTI0MFCK1YEJGuoaGQAFjVAEgcgCKGgMEowFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Date = _t, Integer = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Date", type text}, {"Integer", Int64.Type}}),
    #"Run R script" = R.Execute("https://community.powerbi.com/t5/Desktop/Microsoft-OleDb-Date-value-Issues-with-column-type-date-with-R/td-p/#"dataset' holds the input data for this script#(lf)library(data.table)#(lf)x<-data.table(dataset)",[dataset=#"Changed Type"]),
    #"""x""" = #"Run R script"{[Name="x"]}[Value],
    #"Changed Type1" = Table.TransformColumnTypes(#"""x""",{{"Date", type date}})
in
    #"Changed Type1"

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *