Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
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 values and the timestamp. When I try to pivot the column to get one column for power and one column for timestamp I get this error :
Too many elements in the enumeration to complete the operation
| Name | Value |
| power_mw | 0 |
| timestamp | 2019-04-24T11:45:57.396440 |
| power_mw | 0 |
| timestamp | 2019-04-24T11:46:02.188844 |
| power_mw | 0 |
| timestamp | 2019-04-24T11:46:07.416614 |
| power_mw | 0 |
| timestamp | 2019-04-24T11:46:12.207765 |
| power_mw | 0 |
| timestamp | 2019-04-24T11:46:17.435759 |
| power_mw | 0 |
| timestamp | 2019-04-24T11:46:22.226059 |
| power_mw | 0 |
| timestamp | 2019-04-24T11:46:27.164159 |
| power_mw | 7163 |
| timestamp | 2019-04-24T11:46:32.252352 |
| power_mw | 4922 |
| timestamp | 2019-04-24T11:46:37.187028 |
| power_mw | 4464 |
| timestamp | 2019-04-24T11:46:42.371088 |
| power_mw | 1747 |
| timestamp | 2019-04-24T11:46:47.203619 |
The table is way bigger than this one, this is just an example. Can anyone please help?
Solved! Go to Solution.
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"
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"
| User | Count |
|---|---|
| 20 | |
| 10 | |
| 8 | |
| 8 | |
| 7 |