Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during AI Skills Fest. This week only. Secure your voucher now.

Reply
Anonymous
Not 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 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
NameValue
power_mw0
timestamp2019-04-24T11:45:57.396440
power_mw0
timestamp2019-04-24T11:46:02.188844
power_mw0
timestamp2019-04-24T11:46:07.416614
power_mw0
timestamp2019-04-24T11:46:12.207765
power_mw0
timestamp2019-04-24T11:46:17.435759
power_mw0
timestamp2019-04-24T11:46:22.226059
power_mw0
timestamp2019-04-24T11:46:27.164159
power_mw7163
timestamp2019-04-24T11:46:32.252352
power_mw4922
timestamp2019-04-24T11:46:37.187028
power_mw4464
timestamp2019-04-24T11:46:42.371088
power_mw1747
timestamp2019-04-24T11:46:47.203619

 

The table is way bigger than this one, this is just an example. Can anyone please help? 

1 ACCEPTED SOLUTION
artemus
Microsoft Employee
Microsoft Employee

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"

View solution in original post

1 REPLY 1
artemus
Microsoft Employee
Microsoft Employee

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"

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.