Documentation

  1. Home
  2. Docs
  3. Documentation
  4. What Questions Can I Ask?
  5. Sorting Data

Sorting Data

Summary: You can use the “Top” or “Bottom” keywords to sort and limit the data. You can also use “Sort by” keyword to sort the data by a column. You can also sort the data from the chart settings.

Using the “Top” or  “Bottom” keywords.

You can sort and limit the data in the answer to your question by using the Top and Bottom keywords. Below is an example:

  • Top 5 countries in revenue this month.

This will return the top 5 countries sorted by revenue this month. Note that if you only use Top and do not specify a number, it will default to the top 10. You can also use Bottom to sort from low to high. As in the case of other keywords, AnswerDock will also understand synonyms for the Top and Bottom, such as least, most, highest, lowest, etc..

Using the “Sort by” keyword

You can use the sort by keyword to apply a sorting to the results returned. For example, if you type:

  • Revenue by country this month sort by country

This will sort the results by ocuntry in ascending order (instead of the default sorting which would be by the total revenue in descending order). You can also specify the sorting order from the search by adding “ascending” (or asc) or “Descending (or desc). For example:

  • Revenue by country this month sort by country Desc

This will sort the results by country in descending order.

Combining the “Sort by” keyword with the “Top/Bottom” keywords

In our previous example, we can add top 15 to limit the data to only 15 records

  • Revenue by country this month sort by country Desc Top 15
Using the chart settings to sort the data

You can use the sort setting for the chart to apply a sorting order to the results returned. For example, if you type:

  • Revenue by country this month.

Then you can change the sorting of the data in chart settings> sort by. By default, the data will be sorted from highest to lowest. The settings for each chart are explained in detail in a dedicated Working with charts section.