Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Tengo un conjunto de datos que se convierten según mi consulta a continuación. Pero algunas líneas que quiero que sean texto pero se conviertan a formato de fecha, a continuación se muestra la captura de pantalla. No quiero que esto se convierta.
let
Source = Excel.Workbook(File.Contents("C:\Users\s441801\Emirates Group\AQEEL - General\CMU Training\Power Query samples\New folder\PQ MASTER FILE.xlsx"), null, true),
Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
Ad_Transformed = Table.AddColumn(Sheet1_Sheet, "Transformed", each
[ numbers = {"0".."9"},
alphabets = {"a".."z", "A".."Z"},
a = Text.ToList([Column3]),
b = List.Select(a, each not List.Contains(alphabets & numbers, _)), //Characters to remove/replace
c = Text.Combine(List.Transform(a, each if List.Contains(b, _) then "-" else _)), //replace other special characters with "-"
d = Text.Combine(List.RemoveItems(Splitter.SplitTextByDelimiter("-")(c), {""}), "-"), //remove extra dashes
e = Splitter.SplitTextByCharacterTransition(each true, (x)=> List.Contains(alphabets & numbers, x))(d), //split any|text
f = Text.Combine(List.Transform(e, each if List.Contains(alphabets, _, (x,y)=> Text.StartsWith(y,x)) then Text.Start(_,1) else _)),
g = Splitter.SplitTextByCharacterTransition((x)=> List.Contains(alphabets & numbers, x), each true)(f), //split text|any
h = Text.Combine(List.Transform(g, each if List.Contains(alphabets, _, (x,y)=> Text.EndsWith(y,x)) then Text.End(_,1) else _))
][h], type text),
#"Promoted Headers" = Table.PromoteHeaders(Ad_Transformed, [PromoteAllScalars=true]),
#"Changed Type" = Table.TransformColumnTypes(#"Promoted Headers",{{"Cage code", type text}, {"Manufacturer Name", type text}, {"Part Number", type text}, {"Item Description", type text}, {"Net price", type number}, {"Unit of Measure", type text}, {"Currency", type text}, {"Lead Time", Int64.Type}, {"Standard Package Qty", Int64.Type}, {"Minimum Order Qty", Int64.Type}, {"Catalog Year", Int64.Type}, {"PartNumber", type text}})
in
#"Changed Type"
Hola @aqeel_shaikh ,
Basándome en su descripción, tomé una captura de pantalla de algunos de sus datos para realizar pruebas. Lo primero que hay que tener claro es que en Power BI, el formato de una columna es uniforme en toda la columna. Por lo tanto, solo aparecerá el formato de texto. Aquí hay una captura de pantalla de mi prueba
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("JcqxCcAwDATAXVTn4V8yROq9hdH+azixy4Nby1STLwsM6+cnPji9LjGSoQQvFcwBHdBPldK6Nw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column3 = _t]),
Ad_Transformed = Table.AddColumn(Source, "Transformed", each
[ numbers = {"0".."9"},
alphabets = {"a".."z", "A".."Z"},
a = Text.ToList([Column3]),
b = List.Select(a, each not List.Contains(alphabets & numbers, _)), //Characters to remove/replace
c = Text.Combine(List.Transform(a, each if List.Contains(b, _) then "-" else _)), //replace other special characters with "-"
d = Text.Combine(List.RemoveItems(Splitter.SplitTextByDelimiter("-")(c), {""}), "-"), //remove extra dashes
e = Splitter.SplitTextByCharacterTransition(each true, (x)=> List.Contains(alphabets & numbers, x))(d), //split any|text
f = Text.Combine(List.Transform(e, each if List.Contains(alphabets, _, (x,y)=> Text.StartsWith(y,x)) then Text.Start(_,1) else _)),
g = Splitter.SplitTextByCharacterTransition((x)=> List.Contains(alphabets & numbers, x), each true)(f), //split text|any
h = Text.Combine(List.Transform(g, each if List.Contains(alphabets, _, (x,y)=> Text.EndsWith(y,x)) then Text.End(_,1) else _))
][h], type text)
in
Ad_Transformed
Proporcione una captura de pantalla de su código después de que se ejecute en los datos y el resultado deseado. De esta manera podemos ayudarte más rápido. Por favor, redacte la información confidencial con antelación.
Saludos
Alberto He
Si esta publicación ayuda, considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente
Hola Albert, olvidé mencionar que cuando descargo a Excel, datos específicos convertidos a formato de fecha.
¿Puede intentar exportar los datos que demostró de Power BI a Excel y ver si obtiene el mismo resultado?
Hola @aqeel_shaikh ,
Gracias por la respuesta, sigue tus pasos en mi visualización para exportar datos como archivos .csv. Surge el problema que ha descrito, que puede deberse a los diferentes métodos de Excel y Power BI para el reconocimiento de tipos de datos. Como alternativa, puede hacer clic con el botón derecho en la columna convertida para marcar la opción de copia y pegarla en Excel, lo que le permitirá lograr el mismo formato que en Power BI.
Saludos
Alberto He
Si esta publicación ayuda, considere Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.