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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
wthomas
New Member

Merging multiple rows into one row

Hello, 

 

I'm trying to figure out a way to pull the date field into each row. In the attached I show what the data looks like and then what I'm looking to achieve. Each record is multiple rows and the date only appears on the first row of the record, but I'm looking to get the date to appear on each row. 

 

Any advice?

 

wthomas_0-1637025324616.png

 

 

Thanks,

 

Whitney

2 REPLIES 2
wdx223_Daniel
Super User
Super User

NewStep=Table.Combine(Table.Group(PreviousStepName,"Column1",{"n",each let a=Table.FirstN(_,3),b=Table.LastN(_,1),c=Table.RemoveLastN(Table.Skip(_,3),1) in a&Table.ReplaceValue(c,"",a[Column3]{0},(x,y,z)=>z,{"Column3"})&b},0,(x,y)=>Byte.From(y="Company Name"))[n])

v-jingzhang
Community Support
Community Support

Hi @wthomas 

 

If your desired result is as the "Desired" part shows, using Power Query to do it is probably not a good option. Power Query will transform data into a table structure that each column has the same data type while your data needs to have date, text and number values in a column. Some data might be coverted into a format of another data type after loading. 

 

However, you can still do it with Power Query if you want. Steps are:

1. Add a conditional column

= Table.AddColumn(Source, "Date", each if [Column1] = "Company Name" then [Column3] else null)

2. Fill down this new column

3. Add a custom column

= Table.AddColumn(#"Filled Down", "Date2", each if [Column1] = "Company Name" or [Column1] = "Invoice account" or [Column1] = "Item" or Value.Is([Column1], type number) then null else [Date])

4. Remove the firstly added column and reorder columns. 

 

Result: (you will find that time values in Column4 are not in time format)

21111801.jpg

 

I created a sample with Power Query in excel, find more details from the attachment.

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.