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
pqsmr
Regular Visitor

Combine text split across multiple rows

I have a table with a Description column with text that has been divided into sections and split across one or more rows.

 

I would like to combine the related rows together into a single row using Power Query in Excel.

 

A example input table might be the following:

 

DescriptionSymbolCUSIP
Invesco Qqq Tr  
Unit Ser 1QQQ46090E103
Select Sector Spdr Trust  
The Technology Select Sector  
Spdr FundXLK81369Y803
Spdr S&P 500 Etf TrustSPY78462F103

 

(Note that there are more columns than I've shown, so I would like a solution that works no matter how many columns the table contains.)

 

In the above example, the description for Symbol QQQ spans two rows, the Description for Symbol XLK spans three rows, and the description for Symbol SPY spans only one row.

 

I would like to transform this source table using Power Query into this output table:

 

DescriptionSymbolCUSIP
Invesco Qqq Tr Unit Ser 1QQQ46090E103
Select Sector Spdr Trust The Technology Select Sector Spdr FundXLK81369Y803
Spdr S&P 500 Etf TrustSPY78462F103

 

Thanks in advance for your help / suggestions.

1 ACCEPTED SOLUTION
HotChilli
Community Champion
Community Champion

If there is consistency with the way rows with Symbol and CUSIP are related to the rows with blank values above them:

You can do this (mostly with the interface)-

Replace blank or space values with null.

Do a Fill Up on the 2 columns.

Do a 'Group By' on Symbol and CUSIP with one aggregation (pick Min, we will edit this in the next step)

Edit the last step in the formula bar to replace 'List.Min' with 'Text.Combine'.

-- 

It will be a little bit more complicated with other columns but that's the start

 

View solution in original post

2 REPLIES 2
HotChilli
Community Champion
Community Champion

If there is consistency with the way rows with Symbol and CUSIP are related to the rows with blank values above them:

You can do this (mostly with the interface)-

Replace blank or space values with null.

Do a Fill Up on the 2 columns.

Do a 'Group By' on Symbol and CUSIP with one aggregation (pick Min, we will edit this in the next step)

Edit the last step in the formula bar to replace 'List.Min' with 'Text.Combine'.

-- 

It will be a little bit more complicated with other columns but that's the start

 

That worked perfectly.  Thank you very much!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.