

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Top n vs bottom n records
Hello Experts,
Please find attached screenshot can you please tell me how shall I get Top n and bottom n records as shown in attached sceenshot.
Thanks,


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi.
You can use either rank() function in expressions or dimension limits tab in preferences.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Let you have below dummy script..
=================
Load * Inline
[
Customer, Sales
A, 120
B, 80
C, 90
D, 100
E, 200
G, 210
H, 150
];
=====================
You want top 2 and bottom 2 customers in your straight table..
Dimension
Customer
Expression
SUM({<Customer = {"=Rank(SUM(Sales),4)<=2 or Rank(-SUM(Sales),4)<=2"}>}Sales)
You can also use below as an expression where vTOP and vBOTTOM are your variable
Create an input box for vTOP and vBOTTOM .... and use below as an expression.
Hope this helps..
SUM({<Customer = {"=Rank(SUM(Sales),4)<=$(vTOP) or Rank(-SUM(Sales),4)<=(vBOTTOM)"}>}Sales)
