Top N returning more than N records

  • I have a data set as below:

    Item, Qty

    1,50

    2,40

    3,30

    4,30

    5,30

    I want to select top 3 from this list. However when I setup the filter in SSRS as Top N with value = 3 I get all five rows back, with rows 3 4 and 5 having the same quantity. Is there a way to ONLY grab top 3 and ignore ties?

    The underlying data cannot be changed so this has to be done in SSRS.

  • Look at using the Rank() function and select a RanK() <= 3.

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

  • ChazMan (3/2/2011)


    Look at using the Rank() function and select a RanK() <= 3.

    Rank is not an option in the Filters -> Operator section. I need to be able to do this within an existing dataset.

  • oops...i just noticed the last line of your first post.

    sorry about that.

    --------------------------------------------------------------------------
    When you realize you've dug yourself into a hole....Step 1...stop digging.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply