# exact_period > AQL Function: Calculate a metric within a custom period, it can be used to compare how a metric performs in a specific period compared to another period :::tip Holistics has also supported Period-Comparison on UI via [dashboard-level Period Comparison](/docs/period-comparison#when-building-a-dashboard) and [widget-level Period Comparison](/docs/period-comparison#when-exploring-a-dataset-or-building-a-visualization) which use `exact_period()` and `relative_period()` behind the scenes ::: ## Definition Calculates a metric within a custom period, it can be used to compare how a metric performs in a specific period compared to another period. **Syntax** ```aml exact_period(metric, time_dimension, time_range) ``` ```aml title="Examples" exact_period(orders.total_orders, orders.created_at, @2022-07-01 - 2022-09-01) // with pipe orders.total_orders | exact_period(orders.created_at, @2022-07-01 - 2022-09-01) ``` **Input** - `metric`: A metric that you want to calculate within a custom period - `time_dimension`: A pre-defined datetime/date dimension that is used for shifting - `time_range`: A datetime literal that specifies an exact time range for shifting. E.g. `@2022-04-01`, `@2022`, `@(last 2 weeks)` (see [Datetime Literals](/reference/aql/datetime-literal) for more details) **Output** The same metric calculated in a custom period. ## Combine with dimension **Categorical dimension** When combining with categorical dimension, `exact_period()` is similar to the `where()` function. The difference is that `exact_period()` will override any applied time filter, while `where()` will add the new filter with using `AND` operator logic. **Time dimension** Similar to [Dashboard custom period comparison](/docs/period-comparison#custom-period-comparison), when combining with another time dimension, `exact_period()` will add the equivalent period specified in `time_range` argument alongside to the other measures of that time dimension For more examples on the differences between the two use cases, please check the _Sample Usages_ section below. ## Sample Usages :::tip Use filtering in reporting to apply your time condition, then use `exact_period()` to compare it with. For all the examples below, the filter on reporting is set as `orders.created_at last 3 months` ::: Let’s say we want to compare total orders from an arbitrary period to the back-to-school season (from July to September). First, creating measure `count(orders.id)` with custom period from `2022-07-01` to `2022-09-01` ```aml count(orders.id) | exact_period(orders.created_at, @2022-07-01 - 2022-09-01) ``` ### On time-series dimension Compare week-by-week the last 3 months of count orders to the back-to-school season in Plot as line chart ### On categorical dimension Compare the last 3 months of count orders to the back-to-school season for each continent Plot as bar chart ## See also - [`relative_period()`](/reference/aql/relative_period) - [`trailing_period()`](/reference/aql/trailing_period) - [`period_to_date()`](/reference/aql/period_to_date) - [`running_total()`](/reference/aql/running_total) - [Time Comparisons](/as-code/aql/learn/time-comparisons)