> For the complete documentation index, see [llms.txt](https://docs.predicthq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.predicthq.com/~/changes/FKlCRbEN09RJbNdGBMD0/integrations/third-party-integrations/integrate-with-a-demand-forecast-in-powerbi.md).

# Integrate with a Demand Forecast in PowerBI

Use PowerBI's AutoML models to forecast demand using PredictHQ technologies.

## Tools

### PredictHQ

* [Features API](/~/changes/FKlCRbEN09RJbNdGBMD0/getting-started/guides/features-api-guides.md)
* [Control Center](https://control.predicthq.com)
* [Suggested Radius](/~/changes/FKlCRbEN09RJbNdGBMD0/api/suggested-radius/get-suggested-radius.md)
* [Beam](/~/changes/FKlCRbEN09RJbNdGBMD0/integrations/integration-guides/beam-data-science-guide.md)
* Notebook: [Forecast-Ready Features at Scale](/~/changes/FKlCRbEN09RJbNdGBMD0/getting-started/guides/beam-guides/forecast-ready-features-at-scale.md)

### Microsoft

* [PowerBI AutoML](https://learn.microsoft.com/en-us/power-bi/transform-model/dataflows/dataflows-machine-learning-integration)

## Guide

### Base Model in PowerBI

The starting point is developing a base model in PowerBI (without PredictHQ data). Using a combination of historical data and time trend features, we quickly developed a base model in PowerBI. This initial version yielded a performance of 48%, a good starting point for further enhancement.

<figure><img src="https://2312509647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtNhzHETmXsrWeVBndqqJ%2Fuploads%2F3FVElNJRctKohn9LsLqw%2Fpowerbi-screenshot.png?alt=media&amp;token=33115a46-04ca-4790-9ae9-ced8cca5d57b" alt=""><figcaption><p>Base model performance in PowerBI (without PredictHQ data)</p></figcaption></figure>

### Improving Base Model Results with PredictHQ

From here you should follow the [Forecast-Ready Features at Scale](/~/changes/FKlCRbEN09RJbNdGBMD0/getting-started/guides/beam-guides/forecast-ready-features-at-scale.md) notebook which makes use of [Beam](/~/changes/FKlCRbEN09RJbNdGBMD0/api/beam.md) and [Features API](/~/changes/FKlCRbEN09RJbNdGBMD0/api/features.md) to work out a set of PredictHQ features that are most impactful to your demand. When we have the relevant PredictHQ features we can enhance the model's accuracy.

### Suggested Radius

When looking for events around a business location (such as a store, a hotel, or another business location) a key question is how far should you look for events. For example, should you look at events in a 0.5-mile radius, a 2-mile radius, or a 10-mile radius from your location? The Suggested Radius API answers this question by returning a radius based on a number of factors that can be used to retrieve events and features around a location.

```python
from predicthq import Client

phq = Client(access_token="YOUR_PREDICTHQ_API_TOKEN")

suggested_radius = phq.radius.search(location__origin="45.5051,-122.6750")
print(suggested_radius.radius, suggested_radius.radius_unit, suggested_radius.location.to_dict())
```

### Demand Decomposition and Anomaly Detection using Beam

Next, the Beam API decomposes our demand data into baseline and remainders. This separation allows us to distinguish regular demand from anomalies and understand the factors driving these demand anomalies, providing a foundation for a more targeted forecasting approach.

<figure><img src="https://2312509647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtNhzHETmXsrWeVBndqqJ%2Fuploads%2FwXRBHqiLRmmj1kHr0a1U%2Fbeam-result-screenshot.png?alt=media&amp;token=7827498c-1dcf-4b14-b685-a95b8ab7ad9e" alt=""><figcaption><p>Beam correlation results shown in Control Center</p></figcaption></figure>

### Feature Importance using Beam

We then utilized Beam's [Feature Importance API](/~/changes/FKlCRbEN09RJbNdGBMD0/api/beam/get-feature-importance.md) to evaluate the impact of various events on demand fluctuations. This API helped us identify which events significantly influenced demand, informing our model about the types of events to prioritize in our forecasting.

<figure><img src="https://2312509647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtNhzHETmXsrWeVBndqqJ%2Fuploads%2FWa6zAmDgsttrsoANiRFB%2Ffeature-importance-result-screenshot.png?alt=media&amp;token=4d9ef57d-8de5-42d4-b914-51e2484fadfa" alt=""><figcaption><p>Feature Importance results shown in Control Center</p></figcaption></figure>

### Forecast-Ready Features using Features API

Finally, using the insights from the Feature Importance API, we employed the Feature API to integrate detailed, relevant event data into our model. This precise merging of event data directly correlated with a notable improvement in our model's performance.

<figure><img src="https://2312509647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtNhzHETmXsrWeVBndqqJ%2Fuploads%2F1iahNHRAyjvSxgxzW9aa%2Ffeatures-table-screenshot.png?alt=media&amp;token=789abd4b-186d-43ac-93a9-575b85fae4ab" alt=""><figcaption><p>Beam and Features API results</p></figcaption></figure>

### Improve Model Performance with PredictHQ Data

Upon integrating this data into PowerBI, we developed an advanced model that combined both historical data and PredictHQ's event data. The outcome was a significant leap in performance, reaching 75%.

<figure><img src="https://2312509647-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FtNhzHETmXsrWeVBndqqJ%2Fuploads%2F3QvjCJaD0JL1Mco2jTGt%2Fpowerbi-improved-perf-screenshot.png?alt=media&amp;token=76bdd82a-327d-49e6-870a-8946cc2c52df" alt=""><figcaption><p>75% performance in PowerBI using PredictHQ data</p></figcaption></figure>

### Conclusion

This demonstration not only underlines the effectiveness of combining PredictHQ's technology with PowerBI but also opens up new avenues for accurate demand forecasting across various industries.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.predicthq.com/~/changes/FKlCRbEN09RJbNdGBMD0/integrations/third-party-integrations/integrate-with-a-demand-forecast-in-powerbi.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
