In this next 'Basics' article, we'll look at how to sort data by different columns in a report.
Much like in Excel, sorting lets you choose which columns you want to sort the data by (alphabetically). This can be very useful if you are looking to change how data is grouped for ease of readability.
Let's start off with a fresh report, a 'Sales by Product Variant' report:
Most reports have a default sort option to define how the data is sorted. You can notice this via the arrow and number in the top of the column header:
This sort header essentially tells you two things.
- The direction of the arrow indicates whether it is ascending or descending (alphabetically, or in this case, High to Low vs. Low to High).
- The Number tells you the Sort Level (1st Sort, 2nd Sort etc).
We'll look at each of these in turn.
Ascending vs Descending
Right away, you can tell from that screenshot above that all of the data is sorted by 'Gross sales', descending from Highest to Lowest. In other words, this report shows me which products had the most sales in the last 30 days.
If I changed the header to be ascending from Lowest to Highest (which we'll cover in a moment), you can see that the data would instead look like this:
Much like in Excel, you can have multiple Sort levels to decide how you want your data sorted. Essentially this comes down to something like "Sort by X, THEN Sort by Y (etc)".
For example, let's say I wanted this report to be sorted by
Yellow - Product title (Ascending, so A-Z) and then
Green - Variant Title (Descending, so Z-A - essentially grouping all the similarly named Variant sizes together into Small, Medium, Large) and then
Red - Gross Sales (Ascending, so High to Low)
The end result would look like this:
As you can see, grouping the data like this makes it much easier to view the data and helps me get an alphabetized list of how products are selling.
Adding, Removing and Changing the Sort
So now that we know how the Sort Options work, let's go through how to add them to a report.
Each of the sort options essentially runs on a 'clickable-cycle'. In other words, every time you click on the header, it cycles to the next stage in the following list:
No Sort -> Sort Ascending -> Sort Descending -> No Sort... (etc)
Really though, this is understand to see in picture terms:
And then back to the beginning again.
Switching Sort Levels
If you are planning on using multiple Sort Levels, you can use this process of adding and removing Sorts to change the different Sort Levels.
First, let's start with that basic 'Sales by Product Variant' report. You'll recall that by default, it was sorted by 'Gross sales' like so:
But if we want something else to be the first sort and THEN 'Gross sales' (like in that 3-tier example above) then the easiest way is to start fresh.
Step 1 - Begin by clicking through (twice) on the 'Gross sales' column header to remove the sort option. You should end up with a report with no Sort options in the header like so:
Step 2 - Click (once) on the 'Product title' header to add an ascending (A-Z) sort like so. Notice that now, the report is sorted by this column.
Step 3 - Then we can go back in and add the 2nd Sort to the 'Gross Sales' column header:
Basically the rule-of-thumb is - Add your 1st Sort Option first, then your 2nd, then your 3rd (etc). This makes it easiest to track at every step, so you can make sure data is being grouped the way you want.
Note that if you removed a lower Sort Level from the list (e.g. removing the first Sort on Product Title) then the next in line would become the new first Sort Level (e.g. in this case, 'Gross sales' would revert to being the first sort on the report).
And that's it!
For a more detailed explanation on this feature, check out our video here.