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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Gstewey
Regular Visitor

Combining rows and sum times

I'd like to combine the values for each machine.   Here I have the machines listed several times, with distint values (time) for planned, running, idle, change over, unplanned, offline.    

 

I'd like to combine all the times from planned - offline into one column by machine name.   

 

So each machine name would be listed once, with the sums of each other column together.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Gstewey ,

Please refer to:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("HY27FUAhCEN3obYQED9ZxWOh+w/xwqtIQrjsLfdKEV/oiEXVhw9Ygw8a44Aa1VjwCW2UwQQt16iocsqW9+jmZD3Q/s6qhkBeRkU4NJKNmLD8YgrSEqEM5ZwP", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Machine name" = _t, Running = _t, Planned = _t, Idle = _t, #"Change Over" = _t, Unplanned = _t, Offline = _t]),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {"Machine name"}, "Attribute", "Value"),
    Custom1 = Table.TransformColumns(#"Unpivoted Columns", {{"Value", each let 
    padded = Text.PadStart(_, 8, "0"),
    parsed = Text.Split(padded, ":") 
    in #duration(0, Int64.From(parsed{0}), Int64.From(parsed{1}), Int64.From(parsed{2})), type duration}}),
    #"Grouped Rows" = Table.Group(Custom1, {"Machine name"}, {{"Duration Total", each List.Sum([Value]), type duration}})
in
    #"Grouped Rows"

vcgaomsft_0-1696388093367.png

Output:

vcgaomsft_1-1696388119062.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

View solution in original post

2 REPLIES 2
Gstewey
Regular Visitor

2023-10-02_13-49-43.png

Anonymous
Not applicable

Hi @Gstewey ,

Please refer to:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("HY27FUAhCEN3obYQED9ZxWOh+w/xwqtIQrjsLfdKEV/oiEXVhw9Ygw8a44Aa1VjwCW2UwQQt16iocsqW9+jmZD3Q/s6qhkBeRkU4NJKNmLD8YgrSEqEM5ZwP", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Machine name" = _t, Running = _t, Planned = _t, Idle = _t, #"Change Over" = _t, Unplanned = _t, Offline = _t]),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(Source, {"Machine name"}, "Attribute", "Value"),
    Custom1 = Table.TransformColumns(#"Unpivoted Columns", {{"Value", each let 
    padded = Text.PadStart(_, 8, "0"),
    parsed = Text.Split(padded, ":") 
    in #duration(0, Int64.From(parsed{0}), Int64.From(parsed{1}), Int64.From(parsed{2})), type duration}}),
    #"Grouped Rows" = Table.Group(Custom1, {"Machine name"}, {{"Duration Total", each List.Sum([Value]), type duration}})
in
    #"Grouped Rows"

vcgaomsft_0-1696388093367.png

Output:

vcgaomsft_1-1696388119062.png

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.