Forum Discussion
Anonymous
7 years agoNot applicable
Error: Too many elements in the enumeration to complete the operation
I have downloaded a bunch of files (each one has one set of data of the power consumption of an electronic device) to Power BI. My goal is to graph the Power along time, so I only need the power valu...
- 7 years ago
Something like this is what you want. Just replace the Source line with your data
// Table1 let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ndG9CoNADMDxd7nZHvnOnc/RTaR0cOgglVbw9RvoVgftrSE//oQMQ1qe2/S6zVvqEqSxG9L6mKf3ep+XmBBgvYBcSK6IvWivnrmayHf1H2s9UMZSikiL9Sxohi0WKRO4m7bY6LK61gZL0SWDNusZTXBvHY2POUdaiZV+uVSiEzzqxYHKjovJMRfK7Ahlx9HFT3CPf7Fh3D5+AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Value = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Value", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"Name"}, {{"Values", each _[Value], type table [Name=text, Value=text]}}), #"Transposed Table" = Table.Transpose(#"Grouped Rows"), #"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]), #"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"power_mw", type any}, {"timestamp", type any}}), Custom1 = List.Zip({#"Changed Type1"[power_mw]{0}, #"Changed Type1"[timestamp]{0}}), Custom2 = Table.FromRows(Custom1), #"Renamed Columns" = Table.RenameColumns(Custom2,{{"Column2", "timestamp"}, {"Column1", "power_mw"}}) in #"Renamed Columns"
artemus
Microsoft Employee
7 years agoSomething like this is what you want. Just replace the Source line with your data
// Table1
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("ndG9CoNADMDxd7nZHvnOnc/RTaR0cOgglVbw9RvoVgftrSE//oQMQ1qe2/S6zVvqEqSxG9L6mKf3ep+XmBBgvYBcSK6IvWivnrmayHf1H2s9UMZSikiL9Sxohi0WKRO4m7bY6LK61gZL0SWDNusZTXBvHY2POUdaiZV+uVSiEzzqxYHKjovJMRfK7Ahlx9HFT3CPf7Fh3D5+AA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Name = _t, Value = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Value", type text}}),
#"Grouped Rows" = Table.Group(#"Changed Type", {"Name"}, {{"Values", each _[Value], type table [Name=text, Value=text]}}),
#"Transposed Table" = Table.Transpose(#"Grouped Rows"),
#"Promoted Headers" = Table.PromoteHeaders(#"Transposed Table", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"power_mw", type any}, {"timestamp", type any}}),
Custom1 = List.Zip({#"Changed Type1"[power_mw]{0}, #"Changed Type1"[timestamp]{0}}),
Custom2 = Table.FromRows(Custom1),
#"Renamed Columns" = Table.RenameColumns(Custom2,{{"Column2", "timestamp"}, {"Column1", "power_mw"}})
in
#"Renamed Columns"