Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Top-N Report with Sorting
jsinai
Hi, I am fairly new to BIRT so forgive me if this is a newbie question.
I am using a custom datasource (a lucene query) and a scripted dataset, and I need to generate a Top-N report from it. I can do this. However, the ranking of the N groups seems random. I would like the results to be ranked from top n to bottom n.
The way I have set up my top n report is as follows:
- I created a group, and I'm grouping on the column I want top n results for
- I created a count aggregation for the same column, and I put the aggregation in the same row as the group
- I added a top n filter to the group to filter by the aggregation
- I removed all other rows from the report so that all I see is the group
Problem: the Sort tab in the group doesn't give me the aggregation as a sort option.
Any help would be appreciated.
Find more posts tagged with
Comments
mwilliams
Hi jsinai,
What is your BIRT version? Also, do you think you could recreate your issue with the sample database and post it in here?
jsinai
I'm sorry for the late reply, but it took me a while to recreate my issue using the classic cars database.
I've attached a report design that illustrates the problem.
I can generate a top n report that shows the number of products for each product line, but I can only sort by product line, not by the number of products.
The results you will see in the attached design are:
Classic Cars 38
Motorcycles 13
Vintage Cars 24
What I want is:
Classic Cars 38
Vintage Cars 24
Motorcycles 13
Please note that my sql query does not include grouping or sorting. This is intentional, as my real data source and scripted dataset don't support those features.
Any help is appreciated.
Julian
mwilliams
If you go into your group editor and put the sorting key there rather than the sort key you have in there, it should work.
jsinai
Thanks very much, I get it now.
mwilliams
You're very welcome! Always glad to help. Let us know whenever you have BIRT related questions!
vijayshankar245
<blockquote class="ipsBlockquote" data-author="mwilliams" data-cid="73151" data-time="1297288355">
<div>
<p>You're very welcome! Always glad to help. Let us know whenever you have BIRT related questions!
</p>
</div>
</blockquote>
<p>Hi</p>
<p> </p>
<p>I have a similar requirement to show top 5 totals based on a group column. </p>
<p>I have group like A to z and I have computed two columns like Column 1 and Column 2 aggregated on Group and then I have calculated the total (Column 1 + Column 2).</p>
<p>I have given sorting option in the group as total top n = 5</p>
<p>Also i have filtered the group on total desc. But I didnt get the desired results all I'm getting is blank output,</p>
<p>I want output as below,</p>
<p> </p>
<p>Group Column1 Column 2 total</p>
<p> </p>
<p>A 1000 1000 2000</p>
<p>G 980 1000 1980</p>
<p>Z 980 920 1900</p>
<p>E 950 900 1850</p>
<p>H 500 700 1200</p>
<p> </p>
<p> </p>
<p>Please help if i have missed anything. I'm using BIRT 4.4.0</p>
pricher
<p>Hi,</p>
<p> </p>
<p>In the attached example, I have a table grouped on COUNTRY with 2 aggregations (AggregationCol1 and AggregationCol2) and their Total:</p>
<p> </p>
<p>
vijayshankar245
<blockquote class="ipsBlockquote" data-author="pricher" data-cid="144643" data-time="1468935771">
<div>
<p>Hi,</p>
<p> </p>
<p>In the attached example, I have a table grouped on COUNTRY with 2 aggregations (AggregationCol1 and AggregationCol2) and their Total:</p>
<p> </p>
<p><img src="
http://developer.actuate.com/community/forum/public/style_images/developer_actuate_images/attachicon.gif"
; alt="attachicon.gif"><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?app=core&module=attach§ion=attach&attach_rel_module=post&attach_id=13469'>Snap
2016-07-19 at 09.36.57.png</a></p>
<p> </p>
<p>The filtering and sorting needs to be added to the COUNTRY Grouping properties, as shown here:</p>
<p><img src="
http://developer.actuate.com/community/forum/public/style_images/developer_actuate_images/attachicon.gif"
; alt="attachicon.gif"><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?app=core&module=attach§ion=attach&attach_rel_module=post&attach_id=13470'>Snap
2016-07-19 at 09.39.40.png</a></p>
<p><img src="
http://developer.actuate.com/community/forum/public/style_images/developer_actuate_images/attachicon.gif"
; alt="attachicon.gif"><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?app=core&module=attach§ion=attach&attach_rel_module=post&attach_id=13471'>Snap
2016-07-19 at 09.41.10.png</a></p>
<p> </p>
<p>Hope this helps,</p>
<p> </p>
<p>P.</p>
</div>
</blockquote>
<p>Thanks PRicher. But in your example you have used dataset.</p>
<p>we are using linked data model in our report, so the grouping top N option is not working. Getting the attached error. Please help if you know a solution for a linked data model.</p>
pricher
<p>Hi,</p>
<p> </p>
<p>Can you send your data design and report design?</p>
<p> </p>
<p>Thanks,</p>
<p> </p>
<p>P.</p>
vijayshankar245
<blockquote class="ipsBlockquote" data-author="pricher" data-cid="144671" data-time="1469022181">
<div>
<p>Hi,</p>
<p> </p>
<p>Can you send your data design and report design?</p>
<p> </p>
<p>Thanks,</p>
<p> </p>
<p>P.</p>
</div>
</blockquote>
<p>Thanks Pricher</p>
<p> </p>
<p>I used a filter <strong>IsTopN column is true</strong> in the Edit group instead of TopN Column less than or equal 5. It works now.</p>