Forum Discussion
Anonymous
5 years agoNot applicable
Creating a new table from an URL Web page
Hi everyone, I´m having the following issue, i connected my power bi to an online page that posts a financial value everyday. Here´s a look at the table: You can see that the first column...
- 5 years ago
Hi Anonymous ,
you can do it in Power Query (see attached PBIX file):
// 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"With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)
FrankAT
Community Champion
5 years agoHi Anonymous ,
you can do it in Power Query (see attached PBIX file):
// 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"
With kind regards from the town where the legend of the 'Pied Piper of Hamelin' is at home
FrankAT (Proud to be a Datanaut)
Anonymous
5 years agoNot applicable
This did exactly what i needed, thanks a lot man !