4

How can I limit the number of rows returned in a group?

So far, when the report runs, it returns a lot of records for each group. However, I only want it to return the top 4 records in each group.

I tried the expression: =Ceiling(RowNumber(Nothing)/4) but that's not what I am looking for.

I am using SQL Server 2012 Data Tools (Visual Studio 2010)

Thanks.

Guillermo Greco
  • 63
  • 1
  • 1
  • 5
  • 1
    Can you do it in the SQL? – Tab Alleman Feb 18 '15 at 20:40
  • 1
    I could, but eventually the user will want to filter by different rows. For now, I want to set it to 4 rows on Reporting Services. Finding out how to do this will make it easy to change it later. I don't want to hard code it on the Stored Procedure that I am using. – Guillermo Greco Feb 18 '15 at 20:45

1 Answers1

6

In the group's properties, set a filter on the field you want, choose "Top N" as the operator, and 4 as the value.

Jeffrey Van Laethem
  • 2,601
  • 1
  • 20
  • 30