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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
MarkusEng1998
Resolver II
Resolver II

Insert blank row at the end

I can insert a blank row using this code:

 

= Table.InsertRows(Source, 0,{Record.FromList(List.Repeat({""},Table.ColumnCount(Source)),Table.ColumnNames(Source))})

 

but the zero inserts at the beginnng of the table.

I would like to insert the blank row at the last row.

MarkusEng1998_0-1716577389748.png

 

 

I tried using Table.PositionOf(Source, RowAsRecord) but do not know how to extract the RowAsRecord.   

 

 Table.LastN(Source, 1)    // locates the row, but is not a record type.

 

     Finally I tried converting it to a record, but is not in the format [name="", value=""]

 

Record.FromTable(Table.LastN(Source, 1))

 

 

Hence, this code does not work:

 

= Table.InsertRows(Source, 

  Table.PositionOf(Source, 
		Record.FromTable(Table.LastN(Source, 1))),
		
  {Record.FromList(List.Repeat({""},Table.ColumnCount(Source)),Table.ColumnNames(Source))})

 

 

Please advise. Thank you!

1 ACCEPTED SOLUTION
watkinnc
Super User
Super User

Replace the "0" with Table.RowCount(Source). This will give you the row count, which is one more than the zero based index of the last row.

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

View solution in original post

2 REPLIES 2
MarkusEng1998
Resolver II
Resolver II

Thank you @watkinnc that was easy!

watkinnc
Super User
Super User

Replace the "0" with Table.RowCount(Source). This will give you the row count, which is one more than the zero based index of the last row.

 

--Nate


I’m usually answering from my phone, which means the results are visualized only in my mind. You’ll need to use my answer to know that it works—but it will work!!

Helpful resources

Announcements
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

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

Top Solution Authors