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

Data Days is here! Join us now for 60+ days of learning, challenges, and connection. Learn more

Reply
JesusHairdo
Frequent Visitor

First and Last Row

Hi, I am familiar with Table.LastN and Table.FirstN but I have a scenario where I need to keep the first and last rows of a filtered column. 

At the moment I have 2 filter operations that keep first and last rows which I then merge to form my desired table. 

Ideally I would do this without the merge and then transpose the table to produce the final outcome.  

3 REPLIES 3
serpiva64
Solution Sage
Solution Sage

Please, 

make an example of what you desire

Thanks for the reply. 

I'll knock something up tomorrow but an example would be if I had 10 rows i would keep rows 1 and 10.  If it were 27 it would be rows 1 and 27. 

Anonymous
Not applicable

In your query, at the point where you want to extract the first and the last row, steps are:

  1. Duplicate your query in Power Query.
  2. Go to first query and Keep Rows  > Keep Top Rows > 1 > Ok
  3. Go to duplicated query and Keep Rows > Keep Bottom Rows > 1 > Ok
  4. Append first and duplicated query as new query or existing query to obtain the required result.

Thank you.

If my answer helps you, please mark it as solution.

Helpful resources

Announcements
Fabric Data Days is here Carousel

Fabric Data Days 2026

Don't miss out on Data Days, June 15 through August 7. Learn Fabric, Power BI, SQL, AI and more.

May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

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.