Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Creating a Top 5 summary

Featured Replies

Hi All,

I have created a report showing me the total sales from my customers per year.

What I am trying to see now is only my top 5 customers for the year.

Currently it is showing me all the customers that have dealt with me for the year.

How do I limit it to showing me only the top 5 of the total sales per customer?

Each page represents a year and the top 5 for the year.

I am 98% there......

Thanks in advance...

Dean

At the moment it looks like this:

2008

1. ACME Company $10,0000

2. ABC Company $ 9,0000

3. Bob The Builder $ 8,500

4. Jackie Jones $ 5,000

5. 123 Company $ 4,000

6. XYZ Company $ 3,500

7. Smith The Plumber $ 3,000

8. John Doe $ 2,800

9. Bob Citizen $ 2,500

10. Peter Smith $ 2,000

11. Jason Green $ 1,500

12. Mike Brown $ 1,000

13. Robert White $ 500

14. Sarah Jane $ 300

15. Kelly White $ 200

I want it to look like this:

2008

1. ACME Company $10,0000

2. ABC Company $ 9,0000

3. Bob The Builder $ 8,500

4. Jackie Jones $ 5,000

5. 123 Company $ 4,000

Edited by Guest

One method...

Create a layout that only has the primary key for the customer create a script that sorts the records by order of sales, go to that layout copy all records,

Go to Layout ["CUSTOMERID"]

Perform Find [Restore]

Sort Records [Restore; No dialog]

Copy All Records/Requests

Go to Layout ["DATA ENTRY"]

Paste [select; customer::globalID]

then insert more steps to goto related records by the items in the global id field

thus you have isolated your top five customers.

How about:

Show All Records

Sort

Go to Record #6

Omit Multiple [ Get (FoundCount) - 5 ]

elegant and simple as usual...

It wasn't stated in the original post but I suspect that this may be a sub summarized report.

so either method would only result in the first five records of the top client.

You can do the same thing in conjunction with Edoshin's Fast Summaries method. Roughly:

Loop

Exit if you're on the last record

Jump 5 records ahead

Omit Multiple [ GetSummary ( sCount ; Category ) - 5 ]

End loop

It wasn't stated in the original post but I suspect that this may be a sub summarized report.

So did I originally, this seems a little tricky to me that you first sort in groupings and then find those groups where the summary is among the high five, can this be done without storing anything temporarily???

--sd

  • Author

Thank you for your kind answers, but I did forget to mention that the report is a sub summarized report.

At the moment the individual records show the individual sales of the clients.

When I do a sub summary of that clients sale.

But I am getting all of my clients, but only want to see my top 5 leading customers for each year.

So far in the script I have it sorted by year and then customer.

Then in the report I have sub summarized it by Year and the customer.

It is showing me exactly what I want, but I have for example in 2008, a list of 50 customers totals, I only want the 5 showing.

Sorry for not mentioning that at the beginning.

well you could to Goto Related record with the check box using all records from found set then use Comment's technique.

Goto Related Record Matching all in found set

Sort thru the relationship sort it by a field that is a sum or total of sales.

Go to Record #6

Omit Multiple [ Get (FoundCount) - 5 ]

Create a layout from the context of the client for printing omitting all but the first five.

Uhm... in case it wasn't clear, my last post addresses the issue.

Uhm... in case it wasn't clear, my last post addresses the issue.

Well I for one do not get it, using Edoshins method the way you descripe it only gives the five first of each category if they're available, how does it relate to volume of the sales - the count merely deals with the number of records. Shouldn't a single customer with a whopping purchase that beats everthing else that year go straight to the top of the list, is it more loyal to make many small handouts during the year?

http://en.wikipedia.org/wiki/Pareto_principle

--sd

it only gives the five first of each category if they're available, how does it relate to volume of the sales

I am not sure I understand the difficulty you point to. The first five of each category are determined by the sort order. So it's just a matter of sorting correctly. Here's a more detailed description of the algorithm:

Find the records you want to report on;

Sort by Year (ascending), Customer (descending, re-order by TotalOfSales);

Go to first record;

Loop:

Exit loop when you get to the last record in found set;

If Year ≠ $year, set $year to Year and $i to 1; else set $i to =+1;

If $i > 5, omit the customer's records; else skip to next customer;

End loop

P.S. If there are many sales to small customers, you could economize this by remembering how many records are there in the entire year, and how many have been skipped already. So when you get to customer #6, you can omit all the remaining records in the current year at once.

Indeed - I have forgotten about or ignored the feature shown in the image above.

I've too attached my fooling around with the technique! But one thing bothers me slightly, the total of sales is only the figure among the top 5, the years sale needs to get stored in global before attempting to strain... or?

--sd

top5.jpg

TopFive.zip

Edited by Guest

Yes, the totals are irrelevant here, since they reflect the found set. I have purposefully limited myself to manipulating the found set only. This way you can produce the same report for certain products only, for example, just by finding them first.

But it should be possible to do the same thing with relationships - provided that the find criteria can be translated to predicates. Then you'd have access to the unfiltered totals (or differently-filtered totals).

  • Author

Thanks for the discussion everyone.

Top make it easier for everyone, cause I am getting confused by all these different scripts...

I have attached the current report, the script I made & the layout settings for the report.

In the report view, you will see my sales for 2001 & 2002.

For example, Mark Corbett did $2850.00 dollars in 2002. He was my no 1 customer at the time.

The $2850.00 is a summary of 19 records.

I cannot omit records cause that will remove the individual sales and not give the correct data.

The report attached is exactly what I want, but I only want to see the top 5 highest sales.

See the attached pictures and see if I am doing anything wrong or if you need more screen shots, I will post them too.

Thanks,

Dean

  • Author

it's not letting me attached the PDF

You can get it from my website...

http://public.me.com/deanredding

Dean you can delete the above messages, as well as reclaim storage place on you virtual drive...

--sd

Screenshots.pdf

  • Author

So how did you go?

Is there a solution that can help?

and based on my screen shots, can I get it to be the Top 5 customers?

By the way, Im the one who asked the original question at the top of this post.

Is there a solution that can help?

Now where we have established how to make a top 5 summary, is it required to put the result into two aligned global fields:

http://www.kevinfrank.com/download/kf-fast-summary.zip

Is it enough to go on??

--sd

two aligned global fields

I believe those are actually printing columns.

I cannot omit records cause that will remove the individual sales and not give the correct data.

Are you sure? Here grouped by year ... as suggested by Comment!

--sd

TopFiveMod.zip

as suggested by Comment!

Not quite. You are making it too easy for yourself by having inadequate data (this is the reason why I haven't posted a demo - I am too lazy to generate the necessary test data). You should have records spanning multiple years, and enough of them to make a difference between a summary report (by year/customer) and a report of top 5 customers in each year.

  • Author

Thank you for your attached file, it seems to be what I am after.

I will look into your file and convert it to my database...

thank you for your help, I really appreciate it.

You should have records spanning multiple years, and enough of them to make a difference between a summary report

Why? Comments theorem, is not the same as Fermat's dito! Where might it be that straw breaking the back of the kamel?

--sd

I can see what I'm ignoring thanks for pointing it out, top fiving should be looped to deal with all occurences of breakers.

--sd

:thumbup:

--sd

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.