cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BrianHFASPS
Continued Contributor
Continued Contributor

Filter / FIrst to skip rows?

I have an SQL View that has some number of rows returned. I want to sort it on one column then show only the first 10 records in one gallery and then show all records after 10 in another gallery. I know how via FirstN to get the first 10 but how can I skip the first 10 and return the rest? I tried in the SQL view but I wasn't sure it was reliable since it relied upon sorting first. Any suggestions?

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User
Super User

@BrianHFASPS 
To get the first 10 ten rows I assume your code looks like this:

FirstN(Sort(your_datasource_name), 10);

 

Then you could use LastN to get the opposite result.

LastN(Sort(your_datasource_name), Max(CountRows(your_datasource_name)-10,0));

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

View solution in original post

1 REPLY 1
mdevaney
Super User
Super User

@BrianHFASPS 
To get the first 10 ten rows I assume your code looks like this:

FirstN(Sort(your_datasource_name), 10);

 

Then you could use LastN to get the opposite result.

LastN(Sort(your_datasource_name), Max(CountRows(your_datasource_name)-10,0));

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up." 

Helpful resources

Announcements
October Events

Mark Your Calendars

So many events that are happening this month - don't miss out!

Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Top Solution Authors
Top Kudoed Authors
Users online (2,031)