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.
Hola a todos,
Estoy teniendo el siguiente problema, conecté mi power bi a una página en línea que publica un valor financiero todos los días.
He aquí un vistazo a la mesa:
Puede ver que la primera columna corresponde al día del mes y, a continuación, las otras columnas son los meses. Por ejemplo; segunda columna equivale a enero, tercera columna es igual a febrero y así sucesivamente. Para que esta tabla sea útil para mí, necesito crear una nueva tabla con dos columnas, una con la fecha y otra con el valor de esa fecha. Intenté transponer, pero no funcionó como esperaba. ¿Alguna idea sobre cómo puedo obtener eso?
Solved! Go to Solution.
puede hacerlo en Power Query (consulte el archivo PBIX adjunto):
// Table
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("RdLJkQQhDARAX/pdD3SCbOkY/91YBhWzPwUBqYv3feTBozWyYHVC0UTECbUcuU5olch5Qq+FkSdMmRjz+eB9lM6CJ51N9gsbgrrOQvSF+D9NHVjrOEZnIpoUUwgfj4J26GPAg06ghI6jy3Eyu5dFpm+b/I58KOwaheU0doVykCASSCcysTqVqWEVHYf2hRDD5Gx23WbHSTrf4g7jA9mNmgnkMgm5zEQWmX0ah5lkfinEDe50dtVk9nrIqCCVTKHyMIuMYhmZhLZoHrdB3yMpoxP3S+ROOXtTRUfuHMQLg5sKg3RmF7mJYn8J58Z9d/h8Pn8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Dia = _t, Ene = _t, Feb = _t, Mar = _t, Abr = _t, May = _t, Jun = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Dia", Int64.Type}, {"Ene", type number}, {"Feb", type number}, {"Mar", type number}, {"Abr", type number}, {"May", type number}, {"Jun", type number}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Dia"}, "Attribute", "Value"),
#"Merged Queries" = Table.NestedJoin(#"Unpivoted Other Columns", {"Attribute"}, #"Month table", {"Monthname"}, "Month table", JoinKind.LeftOuter),
#"Expanded Month table" = Table.ExpandTableColumn(#"Merged Queries", "Month table", {"Monthnumber"}, {"Monthnumber"}),
#"Added Custom" = Table.AddColumn(#"Expanded Month table", "Date", each #date(Date.Year(DateTime.LocalNow()),[Monthnumber],[Dia])),
#"Reordered Columns" = Table.ReorderColumns(#"Added Custom",{"Date", "Value", "Dia", "Attribute", "Monthnumber"}),
#"Removed Other Columns" = Table.SelectColumns(#"Reordered Columns",{"Date", "Value"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Removed Other Columns",{{"Date", type date}})
in
#"Changed Type1"
// Month table
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs1LVdJRMlSK1YlWcktNArKNwGzfxCIg2xjMdkwCsU2g4pVAtimY7VWaB2SbKcXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Monthname = _t, Monthnumber = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Monthname", type text}, {"Monthnumber", Int64.Type}})
in
#"Changed Type"
Con amables saludos desde la ciudad donde la leyenda del 'Pied Piper de Hamelin' está en casa
FrankAT (Orgulloso de ser un Datanaut)
hola
En el Editor de consultas, haga clic con el botón derecho en el encabezado de su primera columna y seleccione "Desapresúr las demás columnas". A continuación, en una fórmula de columna calculada, puede escribir esta fórmula DAX para crear una fecha
Fecha = 1*(Data[Dia]&"/"&Data[Month]&"/2021")
Espero que esto ayude.
puede hacerlo en Power Query (consulte el archivo PBIX adjunto):
// Table
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("RdLJkQQhDARAX/pdD3SCbOkY/91YBhWzPwUBqYv3feTBozWyYHVC0UTECbUcuU5olch5Qq+FkSdMmRjz+eB9lM6CJ51N9gsbgrrOQvSF+D9NHVjrOEZnIpoUUwgfj4J26GPAg06ghI6jy3Eyu5dFpm+b/I58KOwaheU0doVykCASSCcysTqVqWEVHYf2hRDD5Gx23WbHSTrf4g7jA9mNmgnkMgm5zEQWmX0ah5lkfinEDe50dtVk9nrIqCCVTKHyMIuMYhmZhLZoHrdB3yMpoxP3S+ROOXtTRUfuHMQLg5sKg3RmF7mJYn8J58Z9d/h8Pn8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Dia = _t, Ene = _t, Feb = _t, Mar = _t, Abr = _t, May = _t, Jun = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Dia", Int64.Type}, {"Ene", type number}, {"Feb", type number}, {"Mar", type number}, {"Abr", type number}, {"May", type number}, {"Jun", type number}}),
#"Unpivoted Other Columns" = Table.UnpivotOtherColumns(#"Changed Type", {"Dia"}, "Attribute", "Value"),
#"Merged Queries" = Table.NestedJoin(#"Unpivoted Other Columns", {"Attribute"}, #"Month table", {"Monthname"}, "Month table", JoinKind.LeftOuter),
#"Expanded Month table" = Table.ExpandTableColumn(#"Merged Queries", "Month table", {"Monthnumber"}, {"Monthnumber"}),
#"Added Custom" = Table.AddColumn(#"Expanded Month table", "Date", each #date(Date.Year(DateTime.LocalNow()),[Monthnumber],[Dia])),
#"Reordered Columns" = Table.ReorderColumns(#"Added Custom",{"Date", "Value", "Dia", "Attribute", "Monthnumber"}),
#"Removed Other Columns" = Table.SelectColumns(#"Reordered Columns",{"Date", "Value"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Removed Other Columns",{{"Date", type date}})
in
#"Changed Type1"
// Month table
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45Wcs1LVdJRMlSK1YlWcktNArKNwGzfxCIg2xjMdkwCsU2g4pVAtimY7VWaB2SbKcXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Monthname = _t, Monthnumber = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Monthname", type text}, {"Monthnumber", Int64.Type}})
in
#"Changed Type"
Con amables saludos desde la ciudad donde la leyenda del 'Pied Piper de Hamelin' está en casa
FrankAT (Orgulloso de ser un Datanaut)
Esto hizo exactamente lo que necesitaba, gracias mucho hombre !
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 |
---|---|
1 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |