Forum Discussion
Group by and conditional column
- 4 years ago
Hi, danish169
M code:let Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8vBR0lEyNNE3NALRBlbGBkAajA2NTE2BtCUQJ+WX5iWnKsXqRCs5BZOm3tcFi3pDI3Qdnn7OYOVB7qQZ71GaV6KQXpRfWqCQVFpJhF5P/VCwxgwUjQpJicnZpQVE6Q8B608sLclXSCwpSc1LScwrIdHR4DA3hqo3sTJAVg8WM8UW6CRogIQ6sgaQagU8OiABT4IVmCFPgmacoU/IDFj0YQY/CbZD/GoE0WBgCdEAVgTSAeKA2P6hwJiOBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [user = _t, date = _t, time = _t, duration = _t, number = _t, #"ring time" = _t, #"type" = _t]), #"Changed Type" = Table.TransformColumnTypes(Source,{{"user", type text}, {"date", type text}, {"time", type text}, {"duration", Int64.Type}, {"number", Int64.Type}, {"ring time", Int64.Type}, {"type", type text}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"date", "time", "number"}, {{"Call Routing", each _, type table [user=nullable text, date=nullable text, time=nullable text, duration=nullable number, number=nullable number, ring time=nullable number, type=nullable text]}}), #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Hunt Froup Name", each Table.SelectRows([Call Routing], each ([type] = "I/T" or [type] = "I/U"))), #"Aggregated Custom" = Table.AggregateTableColumn(#"Added Custom", "Hunt Froup Name", {{"user", List.Min, "Hunt Froup Name"}}), #"Added Custom1" = Table.AddColumn(#"Aggregated Custom", "Staff Member", each Table.SelectRows([Call Routing], each ([type] = "INC" or [type] = "OUT"))), #"Aggregated Staff Member" = Table.AggregateTableColumn(#"Added Custom1", "Staff Member", {{"user", List.Min, "Staff Member"}}), #"Added Custom2" = Table.AddColumn(#"Aggregated Staff Member", "duration", each Table.SelectRows([Call Routing], each ([type] = "INC" or [type] = "OUT"))), #"Aggregated duration" = Table.AggregateTableColumn(#"Added Custom2", "duration", {{"duration", List.Min, "duration"}}), #"Added Custom3" = Table.AddColumn(#"Aggregated duration", "ring time", each Table.SelectRows([Call Routing], each ([type] = "INC" or [type] = "OUT"))), #"Aggregated ring time" = Table.AggregateTableColumn(#"Added Custom3", "ring time", {{"ring time", List.Min, "ring time"}}) in #"Aggregated ring time"Result:
Please refer to the attachment below for details.
Hope this helps.
Best Regards,
Community Support Team _ Zeon Zheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
My original post which I REALLY need an answer to is marked as spam - https://community.powerbi.com/t5/Power-Query/Group-by-and-conditional-column/m-p/2233698#M66235
No answer after 24 hours from mods........any suggestions?
Thanks,
Hi All,
I am facing an issue post extracting Data from Data bricks into powerbi.
I checked in data lake the data was upto date. however when post extracting Data into powerbi from data bricks it's showing less number of data even after refreshing N number of tiems.
Eg: data contains 48 weeks of data. Post extraction into powerbi it's showing only first 26 weeks of data. Anyone know what's the issue.please help tat wuld be grt thanks in advance ✌️