Good day everyone, I have question about salesforce Report. Suppose I have a product object with field product_name and quantity. Now I want to create a report that will get the total quantity of every product .After that since I have thousands of product, I only want to show top 5 product_name which has the highest quantity.I've tried to used the group by and limit functionality in report, but using it at the same time is not possible. How will i do it please help . Thank you.

  • Not sure why you want to use group by clause. Do you have multiple products with same name ? do the quantity of all such products(Same name) needs to be added ? – curious_techy Jul 24 '15 at 3:23
  • You probably want to use the HAVING clause – Nick Cook Jul 24 '15 at 3:25
  • The above scenario is just an example. As you know, when we create a salesforce report we have to to choose a format like tabular or summary report. Now what i want is to put a limit in my summary report. I think the question is quite clear. – Hope Jul 24 '15 at 5:14
  • Now able to get it. Not sure who marked it in negative as this is valid scenario and I think also came across similar issue in past. Giving my detail analysis below – curious_techy Jul 24 '15 at 6:17

Limiting Rows of Summary Report is still not supported in Salesforce.

See this similar Idea on Success Community (Merged with other idea) You'll have to use Custom logic to achieve this.

For Ex : say Report is grouping Opportunities by Account and you're trying to show in Report, Top 5 Accounts with maximum number of opportunities

In that scenario, you've use custom logic like trigger(or preferably batch job, if volume is large) Your custom logic will run each day and find Account with maximum no of opportunities and populate a new 'Custom field' with its ranking. Then you can include this Custom-field in report filter( e.g. Ranking__c in 1,2,3,4,5)

Unfortunately, This is the only way I can think of on this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.