Darren S Posted November 6, 2019 Posted November 6, 2019 I have 2 fields that are used to create a simple Bar Chart layout: Customers and Sales. Each field is a list of values I have generated from summary reports using Mikhail Edoshin's Fast Summary technique. Each of the 2 fields contains many values (maybe up to 30 or 40 entries), sorted by Sales. I would like to chart the top 10 Customers (by Sales). How would I use a script to modify the data in each field to keep only the first (or last) 10 values? Thank you.
comment Posted November 6, 2019 Posted November 6, 2019 You could define your chart to use only: LeftValues ( Customers ; 10 ) for Category Labels and: LeftValues ( Sales ; 10 ) for Slice Data. Note: If you're running Fast Summaries only to produce this chart, and you know in advance that you only want the top 10, it might be smarter to modify the script to exit after the 10th group.
Darren S Posted November 6, 2019 Author Posted November 6, 2019 Thanks for the reply. I went with the option to modify the script to exit after the 10th group. To do this I sort by descending order, according to Sales. This works well but will gives me the largest Sales values first. When I chart this as a Bar chart the largest values are on the bottom of the chart. I would prefer the largest to be at the top. I'm not sure how to do this using the Fast Summaries method because the number of Customers will vary. I'm not sure how to start collecting values from the last 10 groups if I were to sort in ascending order. Should I try and work out how to collect the values from the last 10 groups, or should I attempt to reorder the list in the delimited field? Is there another method I should use? Thanks again.
comment Posted November 6, 2019 Posted November 6, 2019 If your records are sorted by Sales, descending, and you are starting from the first (i.e. the largest) group, then you are collecting the values in the order you want them. If the result is in reverse order, it is probably due to your script placing each value at the head of the collected list, instead of at the tail.
Darren S Posted November 6, 2019 Author Posted November 6, 2019 Thanks very much. That was so simple! The answer is sometimes right in front of me - I appreciate you pointing it out.
Recommended Posts
This topic is 1911 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now