---
schema_version: "1"
id: 1951007deb9fca689c5fa360d4911ed787c52be09af80cb4952ed1be61a9408e
title: Forecast Future Data Points with timeseries
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/analytics/bi_dev_guide_saql/guides/concept/bi-saql-examples-timeseries.md
canonical_url: https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/guide/bi-saql-examples-timeseries.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: b1d87240fe53257fce069b05ea47252143b80939691071367db785cee8e93a62
products:
  - Analytics SAQL Developer Guide
  - analytics
---

# Forecast Future Data Points with timeseries

Use existing data to predict what might happen in the future.

## Example - How Many Tourists Will Visit Next Year?

Suppose that you run a chain of retail stores, and the number of tourists in your city affect your sales. Use `timeseries` to predict how many tourists will come to your city next year:

```nolang
q = load "TouristData";
q = group q by ('Visit_Year', 'Visit_Month');
q = foreach q generate 'Visit_Year', 'Visit_Month', sum('NumTourist') as 'sum_NumTourist';

-- If your data is missing some dates, use fill() before using timeseries()
-- Make sure that the dateCols parameter in fill() matches the dateCols parameter in timerseries()
q = fill q by (dateCols=('Visit_Year','Visit_Month', "Y-M"));

-- Use timeseries() to predict the number of tourists.
q = timeseries q generate 'sum_NumTourist' as Tourists with (length=12, dateCols=('Visit_Year','Visit_Month', "Y-M"));

q = foreach q generate 'Visit_Year' + "~~~" + 'Visit_Month' as 'Visit_Year~~~Visit_Month', Tourists;
```

Use a timeline chart and set a predictive line to see the calculated future data. The resulting graph shows the likely number of tourists in the future.

![Diagram showing the meeting dataset.](https://developer.salesforce.com/media/bi_dev_guide_saql/bi_saql_statement_timeseries_tourist.png)

**See Also**

- [timeseries](https://developer.salesforce.com/docs/analytics/bi-dev-guide-saql/reference/bi-saql-statement-timeseries.md)
