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.
Uso worldtimeapi
= Json.Document(Web.Contents("http://worldtimeapi.org/api/timezone/Europe/London"))
que se presenta en formato ISO8601.
2022-03-30T12:41:22.719641+01:00 |
Hasta esto, podía convertir a fecha / hora, pero ahora estoy recibiendo un error. ¿Se debe esto a que los relojes cambian en el Reino Unido?
DataFormat.Error: No pudimos analizar la entrada proporcionada como un valor DateTime.
Detalles:
2022-03-30T12:41:22.784125+01:00
Solved! Go to Solution.
Creo que es la transformación automática de 'cualquier' tipo de datos a 'datetime' lo que no funciona.
Si edita la parte {"datetime",escriba datetime} para que sea {"datetime", escriba datetimezone}, eso debería funcionar sin errores.
A partir de ahí, puede cambiar el tipo a datetime, utilizando el > de interfaz (agregue el paso si se le da la opción, para que sea más obvio).
No estoy seguro de si solía funcionar o si ha habido un cambio en el código de Power Query, pero eso debería hacer que funcione.
Creo que es la transformación automática de 'cualquier' tipo de datos a 'datetime' lo que no funciona.
Si edita la parte {"datetime",escriba datetime} para que sea {"datetime", escriba datetimezone}, eso debería funcionar sin errores.
A partir de ahí, puede cambiar el tipo a datetime, utilizando el > de interfaz (agregue el paso si se le da la opción, para que sea más obvio).
No estoy seguro de si solía funcionar o si ha habido un cambio en el código de Power Query, pero eso debería hacer que funcione.
¡Increíble!
Gracias. Modificaré el resto de mis informes que utilizan este método.
¿Puede publicar el código que cambia el tipo, por favor?
= Table.TransformColumnTypes(#"Converted to Table",{{"abbreviation", type text}, {"client_ip", type text}, {"datetime", type datetime}, {"day_of_week", Int64.Type}, {"day_of_year", Int64.Type}, {"dst", type logical}, {"dst_from", type any}, {"dst_offset", Int64.Type}, {"dst_until", type any}, {"raw_offset", Int64.Type}, {"timezone", type text}, {"unixtime", Int64.Type}, {"utc_datetime", type datetime}, {"utc_offset", type text}, {"week_number", Int64.Type}})
CÓDIGO COMPLETO
let
Source = Json.Document(Web.Contents("http://worldtimeapi.org/api/timezone/Europe/London")),
#"Converted to Table" = Table.FromRecords({Source}),
#"Changed Type" = Table.TransformColumnTypes(#"Converted to Table",{{"abbreviation", type text}, {"client_ip", type text}, {"datetime", type datetime}, {"day_of_week", Int64.Type}, {"day_of_year", Int64.Type}, {"dst", type logical}, {"dst_from", type any}, {"dst_offset", Int64.Type}, {"dst_until", type any}, {"raw_offset", Int64.Type}, {"timezone", type text}, {"unixtime", Int64.Type}, {"utc_datetime", type datetime}, {"utc_offset", type text}, {"week_number", Int64.Type}})
in
#"Changed Type"
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.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |