Karim
Karim

Reputation: 3

How to get Maximum 3 Value?

How to get Maximum 3 value in Crystal Report.

This is my Result

All value show

But my requirement is

maximum 3 value show

Upvotes: 0

Views: 1337

Answers (2)

Marcin Sulecki
Marcin Sulecki

Reputation: 174

You can use the built- in Crystal Reports.

  1. Select Insert | Summary
  2. Choose the field to summarize
  3. In Calculate this summmary choose function "Nth largest, N is" and type 1, 2, 3

Nth largest

Another way is to use the NthLargest function inside formula editor:

NthLargest (1, {SalesOrderHeader.SubTotal}) + NthLargest (2, {SalesOrderHeader.SubTotal}) + NthLargest (3, {SalesOrderHeader.SubTotal})

Upvotes: 1

craig
craig

Reputation: 26262

Create a SQL Expression (SEQ_INV):

(
  row_number() OVER (ORDER BY OrderNo DESC)
)

Add this text to the record-selection formula:

{%SEQ_INV}<4

Upvotes: 0

Related Questions