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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Porkey
Frequent Visitor

Unusual behavior from Table.FirstN

Hello,

 

Im getting unusual behaviour from the Table.FirstN function please see image below, does nyone have any idea why

 

The source is from sharepoint, which is the same as the other queries in the file which are all fine.

Filter to find the filename in a library

Sortby Descending created date

 

All im doing with the function is getting the most recent created file with a specific name.

Porkey_1-1677853047474.png

 

 

The files in the library actually date back to Aug 2022, but November is showing . Ive had a little play around with no success but when i dont include the sort by it gives the first and sixth row instead of the first and fifth which it does wth the sort by.

 

Any idea would be appreciated

 

I have tried an older version of the file that was previously fine, same thing happens.

I have restrated the pc

I have logged in and out of microsoft.

This does not happen on all the queries i have on other workbooks or in powerBI.

I had the same issue on one other sheet about a month ago. Which i just rebuilt to resolve, but i dont wan to have to do that everytime.

Thanks

 

1 REPLY 1
artemus
Microsoft Employee
Microsoft Employee

I belive this is a known bug where doing a first N with 1 on some data sets that only have 1 value could return 2 results. You can try the following workarounds:

1. Get the first row of the table as a record with #"Previous step name"{0}?

2. Add the step before: Table.StopFolding(#"Previous Step")

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

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.

Top Solution Authors