Sorting, Aggregation, and Limiting
This document describes how to sort, aggregate, and limit results in Semantic Metric Queries. These operations allow you to refine and customize your metric query results to meet specific business requirements.
You can sort the results using any of your selected dimensions. Sorting helps organize your metric query results in a meaningful order.
- The following example shows how to apply simple sorting in a metric query:
You can aggregate the results of metric queries using time grains. Time grains allow you to group your metric data by specific time periods.
- Each metric query defines a list of supported time grains in the model, and the metric query selects one of them as shown in the following example:
You can use limiting to constrain the number of result rows returned in the metric query results. This is useful for performance optimization and pagination.
- The limit value is set as part of the SQL "LIMIT" clause. You can customize the default limit value. The Semantic Query supports limits in Run Mode - limits are applied after metric query result grouping. For example: