> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cognite.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get aggregated time series data

> Query Cognite Data Fusion for pre-calculated aggregates of numerical time series data points with short response times.

<span translate="no">Cognite Data Fusion</span> (<span translate="no">CDF</span>) pre-calculates the most common aggregates for numerical data points in time series. These aggregates are available with short response times even when you are querying across large data sets.

Instead of downloading and manually aggregating data in an <span translate="no">OData</span> client, you can query <span translate="no">CDF</span> for the aggregates. Specify the **time range** and the **granularity** (the unit of time to compute the aggregates for) and let <span translate="no">CDF</span> do the computational work.

<a id="get-aggregates-for-a-single-time-series-using-the-odata-services" />

## Get aggregates for a single time series using the <span translate="no">OData</span> services​

In the asset-centric and data modeling OData services, when listing time series, the service exposes a function to retrieve aggregates for **a single time series** from <span translate="no">CDF</span>. To use the function in <span translate="no">Microsoft Power BI</span>:

<Steps>
  <Step title="Navigate to time series table">
    In the <span translate="no">Power Query Editor</span>, navigate to a list of time series table using a <span translate="no">Cognite Power BI</span> connector.
  </Step>

  <Step title="Select the Aggregate function">
    Use filtering to find the time series you want aggregates from, and then in the <span class="ui-element">Aggregate</span> column, select <span class="ui-element">Function</span>.

    <Frame>
      <img src="https://apps-cdn.cogniteapp.com/@cognite/docs-portal-images/1.0.0/images/cdf/dashboards/powerbi/update2024/Timeseries1.png" alt="Locate the CDF OData connector in Power BI" width="80%" />
    </Frame>
  </Step>

  <Step title="Configure time range and granularity">
    Specify the time range and granularity, and then select OK.

    <Frame>
      <img src="https://apps-cdn.cogniteapp.com/@cognite/docs-portal-images/1.0.0/images/cdf/dashboards/powerbi/update2024/Timeseries2_v1.png" alt="Locate the CDF OData connector in Power BI" width="60%" />
    </Frame>
  </Step>

  <Step title="Review and finalize aggregates">
    The <span translate="no">Power Query Editor</span> displays a table with the aggregates for the specified time range. Remove the columns you don't need, then select **Close and apply**.
  </Step>
</Steps>

<a id="get-aggregates-for-many-time-series" />

## Get aggregates for many time series​

To retrieve aggregates from many time series in the same time range, use the **TimeseriesAggregate** function, exposed by the asset-centric OData service. Instead of calling the function on a single time series, create a time series table with all the time series you want to retrieve aggregates from.

In <span translate="no">Microsoft Power BI</span>:

<Steps>
  <Step title="Add Timeseries table andTimeseriesAggregate function as new query">
    Open a connection to the asset-centric <span translate="no">OData</span> service using a <span translate="no">Cognite Power BI</span> connector. Right-click the **Timeseries** table and the **TimeseriesAggregate** function and add them as new query.

    <Frame>
      <img src="https://apps-cdn.cogniteapp.com/@cognite/docs-portal-images/1.0.0/images/cdf/dashboards/powerbi/update2024/Timeseries3.png" alt="Locate the CDF OData connector in Power BI" width="80%" />
    </Frame>
  </Step>

  <Step title="Filter time series">
    Use filtering on the <span class="ui-element">Timeseries</span> table to find the time series you want aggregates from.
  </Step>

  <Step title="Configure function parameters">
    In the <span class="ui-element">Queries</span> panel, select the <span class="ui-element">TimeseriesAggregate</span> function and set the granularity, start time, and end time. Then select <span class="ui-element">Choose column</span>.
  </Step>

  <Step title="Select time series column">
    In the <span class="ui-element">Select Column</span> window, select your <span class="ui-element">Timeseries</span> table and the <span class="ui-element">Id</span> column from the table to specify which time series to fetch aggregates from in <span translate="no">CDF</span>.

    <Frame>
      <img src="https://apps-cdn.cogniteapp.com/@cognite/docs-portal-images/1.0.0/images/cdf/dashboards/powerbi/update2024/Timeseries4.png" alt="Locate the CDF OData connector in Power BI" width="80%" />
    </Frame>
  </Step>

  <Step title="Invoke the function">
    Select <span class="ui-element">Invoke</span> to start retrieving the aggregates.
  </Step>

  <Step title="Review and finalize aggregates">
    The <span translate="no">Power Query Editor</span> displays a new table named <span class="ui-element">Invoked Function</span> in the <span class="ui-element">Query</span> panel with the aggregates for the specified time range. Remove the columns you don't need, then select <span class="ui-element">Close and apply</span>.

    <Info>
      If the <span class="ui-element">TimeseriesAggregate</span> function takes a long time to finish or fails after a long time:

      * Make sure you have filtered the time series table to contain only the time series you need.
      * Consider if you are using the right granularity. The granularity significantly affects the query performance.
      * Request a realistic number of data points. Aggregating large numbers of time series with short granularity may return vast amounts of data points, and <span translate="no">Power BI</span> doesn't handle many gigabytes of data in a single query.
    </Info>
  </Step>
</Steps>
