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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
Anon29
Helper II
Helper II

Group By - updated problem

Hi all, hoping someone can help.

The data below is an example of one phone conversation and the order of the people talking is in order from first contact person being 411 to the last contact person being 8113.

I am wanting to group the Talkorder with the Name. I have tried to split the Talkorder by first two digits and use group by that way, but that doesn't work because all the Talkorders for Bat Man can start with a Talkorder of 811 and continue on till the talkorder is 8113 (sometimes even 6 digits long). Also I want to maintain the Talkorder for the names that genuinely start with three digits, like Aqua Boy, Ken, Super Man and Barbie. 

 

This is what my raw data looks like.

DateNameTalk IDTalkorder
29/08/2023Cat Girlabc123411
29/08/2023Cat Girlabc123414
29/08/2023Super Girlabc123611
29/08/2023Super Girlabc123612
29/08/2023Super Girlabc123613
29/08/2023Cat Girlabc123416
29/08/2023Cat Girlabc123417
29/08/2023Bat Manabc123811
29/08/2023Bat Manabc123812
29/08/2023Bat Manabc123814
29/08/2023Bat Manabc123816
29/08/2023Aqua Boyabc1231111
29/08/2023Aqua Boyabc1231112
29/08/2023Aqua Boyabc1231113
29/08/2023Bat Manabc123818
29/08/2023Bat Manabc1238110
29/08/2023Kenabc1231311
29/08/2023Bat Manabc1238112
29/08/2023Super Manabc1231611
29/08/2023Barbieabc1231711
29/08/2023Barbieabc1231712
29/08/2023Barbieabc1231713
29/08/2023Bat Manabc1238113

 

This is what I want the end result to look like.  I want to maintain the Talkorder so I can sort from lowest number to highest number to get the initial talk order of each person, for each Talk ID.

Anon29_0-1698209389201.png

If it's not possible to have the Talkeorder in that result, I am happy with a ranking list from smallest number to largest number. I just want a way to sort each Talk ID by the Talkorder, but please keep in mind that the raw data is not sorted nicely like in the example and it will be a mix of many different Talk ID not in order. I do not want to use the sort function in Power Query as it makes the refreshes too long.

2 ACCEPTED SOLUTIONS
mlsx4
Super User
Super User

Hi @Anon29 

 

I think you can reach this behaviour in Power Query using Group by like in the screenshot below:

 

mlsx4_0-1698223614809.png

 

View solution in original post

AlienSx
Super User
Super User

Hi, @Anon29 looks like you need to select min Talkorder withing each Talk ID and Name.

let
    Source = raw_data_table,
    group = Table.Group(Source, {"Name", "Talk ID"}, {{"all", each Table.Min(_, "Talkorder")}}),
    expand = Table.ExpandRecordColumn(group, "all", {"Date", "Talkorder"})
in
    expand

talk.jpg

View solution in original post

4 REPLIES 4
Anon29
Helper II
Helper II

Thanks everyone, looks like I gave the wrong data, but the solutions you have given me is correct for the data that I have.

ChielFaber
Super User
Super User

You can create a rownumber per TalkID with the group by function best described in the following blog post by Radacad:

 

https://radacad.com/create-row-number-for-each-group-in-power-bi-using-power-query

 

rownumber per group.PNG


This creates a row number per talkID. The last thing you would need to do is filter on rownumber 1 (or index = 1) using the UI.

Greetings, 

 

Chiel

 

AlienSx
Super User
Super User

Hi, @Anon29 looks like you need to select min Talkorder withing each Talk ID and Name.

let
    Source = raw_data_table,
    group = Table.Group(Source, {"Name", "Talk ID"}, {{"all", each Table.Min(_, "Talkorder")}}),
    expand = Table.ExpandRecordColumn(group, "all", {"Date", "Talkorder"})
in
    expand

talk.jpg

mlsx4
Super User
Super User

Hi @Anon29 

 

I think you can reach this behaviour in Power Query using Group by like in the screenshot below:

 

mlsx4_0-1698223614809.png

 

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors