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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Anonymous
Not applicable

How do you Insert / Add / Duplicate Rows based on cell contents in PowerQuery?

Hi I am very new to PowerQuery and am trying to get assistance navigating M code.


I do not want to create a new column/table. The data set contains over 500K rows of information. 

 

All I want to do is create two additional rows (3 in total), where every [Description] = 12 CT Variety Pack. I would love to also change the [Description] in each of the two additional rows to = 6 CT, Organic and 6 CT, Non-GMO. I would also like the original row remain in place and to be left alone.

I would also like the [Total] to be divided by half in the 2 new rows. 

 

Thank you so much for taking the time to read and respond to this.


Here is an example of what I would like the final product to look like. 

                                           

1 REPLY 1
dax
Community Support
Community Support

Hi spar101,

If you want to add new row in table by PowerQuery, you could try to use expression like below

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUXIE4sjUYqVYnWglIyDbCcaPBQA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [Dimension = _t, #"Dimension Name" = _t, #"From Data Source" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Dimension", Int64.Type}}),
    Custom1 = Table.InsertRows(#"Changed Type",2, { [Dimension = 3, Dimension Name = "Custom Row", From Data Source = "No"] })
in
    Custom1

You could refer to Table.InsertRows for details.

By the way, are these three row are specific rows? Summarize? Or other feature? You could use above expression, if rows are less.

Best Regards,
Zoe Zhi

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

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors