> 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/getting-started/guides/features-api-guides/integrate-with-a-demand-forecast-in-powerbi.md). Agents can also search and read this documentation through its [MCP server](https://docs.predicthq.com/~gitbook/mcp).

# Forecasting demand in Power BI with event features

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

## Tools

### PredictHQ

PredictHQ tools and resources:

* [Features API](https://docs.predicthq.com/getting-started/guides/features-api-guides.md)
* [Beam](https://docs.predicthq.com/getting-started/guides/beam-guides.md)
* [Predicted Impact Area](https://docs.predicthq.com/api/impact-area/get-impact-area.md)
* [WebApp](https://control.predicthq.com)
* Tutorial: [Improving demand forecasting models with event features](https://docs.predicthq.com/getting-started/guides/features-api-guides/improving-demand-forecasting-models-with-event-features.md)

### Microsoft

Microsoft tools and resources:

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

## Guide

{% embed url="<https://vimeo.com/905617307>" %}
Xuxu Wang (CDO) demoing this approach with PowerBI
{% endembed %}

### 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 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="PowerBI screen showing the base model&#x27;s performance of 48%, built without PredictHQ data"><figcaption><p>Base model performance in PowerBI (without PredictHQ data)</p></figcaption></figure>

### Improving base model results with PredictHQ

From here, follow the [Improving demand forecasting models with event features](https://docs.predicthq.com/getting-started/guides/features-api-guides/improving-demand-forecasting-models-with-event-features.md) tutorial book which helps you work out a set of PredictHQ features that are most impactful to your demand using [Beam](https://docs.predicthq.com/api/beam/overview.md) and [Features API](https://docs.predicthq.com/api/features/get-features.md). When we have the relevant PredictHQ features we can enhance the model's accuracy.

### Predicted Impact Area

Most teams start with a fixed radius when scoping events around a location. The problem is that the distance over which events influence demand varies—by industry, by location type, and by how people actually move in that area. A radius that works in one market will miss impact or introduce noise in another.

The Predicted Impact Area API returns a location and industry-specific polygon boundary that reflects where event-driven demand impact actually occurs. PredictHQ calibrates boundaries against real demand and event data across industries and geographies.

The recommended approach is to use Saved Locations. When you create a location using `origin_geojson` without specifying a `geojson` area, PredictHQ calculates Predicted Impact Area automatically and stores it against that location. You can then use the `location_id` across all PredictHQ APIs—Events, Features, and Beam—without needing to manage the boundary yourself.

The following example requests the Predicted Impact Area for a location:

```python
import httpx

response = httpx.get(
    "https://api.predicthq.com/v1/impact-area/",
    headers={
        "Authorization": "Bearer YOUR_PREDICTHQ_API_TOKEN",
        "Accept": "application/json",
    },
    params={
        "location.origin": "45.5051,-122.6750",
        "industry": "restaurants",
    },
)

print(response.json())
```

### 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="WebApp screen showing the Beam correlation results for the demand data"><figcaption><p>Beam correlation results shown in the WebApp</p></figcaption></figure>

### Feature Importance using Beam

We then utilized Beam's [Feature Importance API](https://docs.predicthq.com/api/beam/analyses/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="WebApp screen showing the Feature Importance results that rank events by their influence on demand"><figcaption><p>Feature Importance results shown in the WebApp</p></figcaption></figure>

### Forecast-ready features using Features API

Finally, using the insights from the Feature Importance API, we employed the Features 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="Table combining Beam results and Features API event features for each date"><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="PowerBI screen showing the improved model performance of 75% with PredictHQ data"><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/getting-started/guides/features-api-guides/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.
