# Auto Insert Rows in PowerQuery to a Table



## QTHUYNH (Dec 15, 2017)

Any know how to auto insert a row in a table based off of set criteria? I have two tables I'm working with.

1st Table is the main output table with part number, price, dates, po #, vendor name.
2nd Table is a list of part numbers and licensing fees per unit per part number.

Right now everything is done manually via IFs and VLookups in excel.

In the current state, the row in red is manually inserted if the _IF and Vlookup_ formula in the "Licensing Fee" column is "Yes". 

The main driver is Part Number. All other info in the RED row was copied from the row above it except for the Price/Unit.

I want to be able to replicate and automate this manual process in Power Query. Example below.



Example

DateVendor*Part Number*PO #QtyPrice / UnitTotalLicensing Fee1/10/99WylieZYX-112344100100$10,000No1/11/99ACMEXYZ-112345100125$12,500Yes*1/11/99**ACME**XYZ-1**12345**25**$(2,500)*

<tbody>

</tbody>


----------



## Matt Allington (Dec 21, 2017)

What I would do is this

1 set the original table to “do not load”
2 create a reference to this table and filter for the event where a new record is required. 
3 make changes to the table in 2 so it has the records you want
4 append table from 3 to 1


----------



## QTHUYNH (Feb 13, 2018)

Thanks for your help Matt.

That's exactly what I did and it solved the problem.


----------

