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
Mis datos están en el siguiente formato
Emp ID | Tipo de pago | Eficaz desde | Eficaz para | Cantidad |
100001 | Básica | 1/Ene/2019 | 31/Jul/2019 | 1000 |
100001 | Básica | 1/Aug/2019 | 31/Dic/2019 | 1500 |
100001 | Juego | 1/Ene/2019 | 31/Jul/2019 | 100 |
100001 | Juego | 1/Aug/2019 | 31/Dic/2019 | 150 |
Quiero transformar los datos para
Emp ID | Mes | año | Básica | Juego |
100001 | Enero | 2019 | 1000 | 100 |
100001 | Febrero | 2019 | 1000 | 100 |
100001 | Marzo | 2019 | 1000 | 100 |
100001 | Abril | 2019 | 1000 | 100 |
100001 | Mayo | 2019 | 1000 | 100 |
100001 | Junio | 2019 | 1000 | 100 |
100001 | Jul | 2019 | 1000 | 100 |
100001 | Agosto | 2019 | 1500 | 150 |
100001 | Septiembre | 2019 | 1500 | 150 |
100001 | Octubre | 2019 | 1500 | 150 |
100001 | Noviembre | 2019 | 1500 | 150 |
100001 | Diciembre | 2019 | 1500 | 150 |
Reqeust usted me guía por favor en la dirección correcta.
Gracias de antemano.
Solved! Go to Solution.
Hola @MohammedAli
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQAAkMlHSWnxOLMZCBtqO+VmKdvZGBoCeQYA3mlOTAeSK1SrA5WTY6l6UiaXFKT4ZpM0TV5BDkStAe7DnyWKMXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Emp ID" = _t, #"Pay Type" = _t, #"Effective From" = _t, #"Effective To" = _t, Amount = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Emp ID", Int64.Type}, {"Pay Type", type text}, {"Effective From", type date}, {"Effective To", type date}, {"Amount", Int64.Type}}),
#"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[#"Pay Type"]), "Pay Type", "Amount"),
#"Added Custom" = Table.AddColumn(#"Pivoted Column", "Custom", each List.Dates([Effective From],Duration.Days([Effective To]-[Effective From])+1,#duration(1,0,0,0))),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each List.Select([Custom],each Date.Day(_)=1)),
#"Expanded Custom.1" = Table.ExpandListColumn(#"Added Custom1", "Custom.1"),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Custom.1",{"Custom"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Custom.1", "new date"}}),
#"Inserted Year" = Table.AddColumn(#"Renamed Columns", "Year", each Date.Year([new date]), Int64.Type),
#"Inserted Month Name" = Table.AddColumn(#"Inserted Year", "Month Name", each Date.MonthName([new date]), type text),
#"Extracted First Characters" = Table.TransformColumns(#"Inserted Month Name", {{"Month Name", each Text.Start(_, 3), type text}})
in
#"Extracted First Characters"
Saludos
Maggie
Equipo de apoyo a la comunidad _ Maggie Li
Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
Hola @MohammedAli
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQAAkMlHSWnxOLMZCBtqO+VmKdvZGBoCeQYA3mlOTAeSK1SrA5WTY6l6UiaXFKT4ZpM0TV5BDkStAe7DnyWKMXGAgA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Emp ID" = _t, #"Pay Type" = _t, #"Effective From" = _t, #"Effective To" = _t, Amount = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Emp ID", Int64.Type}, {"Pay Type", type text}, {"Effective From", type date}, {"Effective To", type date}, {"Amount", Int64.Type}}),
#"Pivoted Column" = Table.Pivot(#"Changed Type", List.Distinct(#"Changed Type"[#"Pay Type"]), "Pay Type", "Amount"),
#"Added Custom" = Table.AddColumn(#"Pivoted Column", "Custom", each List.Dates([Effective From],Duration.Days([Effective To]-[Effective From])+1,#duration(1,0,0,0))),
#"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom.1", each List.Select([Custom],each Date.Day(_)=1)),
#"Expanded Custom.1" = Table.ExpandListColumn(#"Added Custom1", "Custom.1"),
#"Removed Columns" = Table.RemoveColumns(#"Expanded Custom.1",{"Custom"}),
#"Renamed Columns" = Table.RenameColumns(#"Removed Columns",{{"Custom.1", "new date"}}),
#"Inserted Year" = Table.AddColumn(#"Renamed Columns", "Year", each Date.Year([new date]), Int64.Type),
#"Inserted Month Name" = Table.AddColumn(#"Inserted Year", "Month Name", each Date.MonthName([new date]), type text),
#"Extracted First Characters" = Table.TransformColumns(#"Inserted Month Name", {{"Month Name", each Text.Start(_, 3), type text}})
in
#"Extracted First Characters"
Saludos
Maggie
Equipo de apoyo a la comunidad _ Maggie Li
Si este post ayuda, entonces considera Aceptarlo como la solución para ayudar a los otros miembros a encontrarlo más rápidamente.
@MohammedAli, consulte si esto puede ayudar a
o este archivo
https://www.dropbox.com/s/fnq82ksdzk1lqs3/Target_allocation_daily.pbix?dl=0
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 |