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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
pbin9_9
Regular Visitor

PBI Column Based Unstructured Data Grouping

Hi All,

I have a dataset as below,

Data
Group1
Jeremiah Lee
Joshua Doyle
Group2
Julie Miller
Beth Stein
Group3
Sierra Carroll
Zachary Williams
Group1
Paul Wilson
Group2
Abigail Nelson
Group3
Raymond Dillon
Mark Rodriguez
Group1
Glenn Collins
Robin Horne
Group2
Angelica White
Robert Ryan
Robert Wright
Raven Davis
Tara Meyers
Group3
Cynthia Smith
John Sanchez
Lori Gilbert

 

The column name is Data

Basically I want to group names for each Groups
The expected output is something like that for a few example,

Group1Jeremiah Lee
Group1Joshua Doyle
Group1Paul Wilson
Group2Julie Miller
Group2Beth Stein
Group2Abigail Nelson
Group3Sierra Carroll
Group3Zachary Williams
Group3Raymond Dillon
Group3Mark Rodriguez


Power Query or DAX solutions would be fine, actually I have no idea how can I make this grouping.
Is there anyone have idea on it ?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @pbin9_9 ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2)Click "Transform Data" to go to the Power Query editor, add index columns, click Apply and close.

(3) We can create a table.

Table 2 = var a=ADDCOLUMNS('Table',"groups",LOOKUPVALUE('Table'[Data],'Table'[Index],MAXX(FILTER('Table',[Index]<EARLIER('Table'[Index])&&CONTAINSSTRING([Data],"Group")),[Index])))
var b=ADDCOLUMNS(a,"Combine",IF(CONTAINSSTRING([Data],"Group"),BLANK(),[groups]&":"&[Data]))
return SUMMARIZE(FILTER(b,[Combine]<>BLANK()),[Combine])

 (4) Then the result is as follows.

vtangjiemsft_0-1678862059567.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @pbin9_9 ,

 

According to your description, here are my steps you can follow as a solution.

(1) My test data is the same as yours.

(2)Click "Transform Data" to go to the Power Query editor, add index columns, click Apply and close.

(3) We can create a table.

Table 2 = var a=ADDCOLUMNS('Table',"groups",LOOKUPVALUE('Table'[Data],'Table'[Index],MAXX(FILTER('Table',[Index]<EARLIER('Table'[Index])&&CONTAINSSTRING([Data],"Group")),[Index])))
var b=ADDCOLUMNS(a,"Combine",IF(CONTAINSSTRING([Data],"Group"),BLANK(),[groups]&":"&[Data]))
return SUMMARIZE(FILTER(b,[Combine]<>BLANK()),[Combine])

 (4) Then the result is as follows.

vtangjiemsft_0-1678862059567.png

Best Regards,

Neeko Tang

If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly. 

Hi @Anonymous ,
It's definetely working and the results what I want ! 
Thanks&Regards

Helpful resources

Announcements
Fabric Data Days is here Carousel

Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

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.