# Using Dagster with Power BI

> Monitor a Power BI workspace as assets in Dagster.

Source: https://dagster.io/integrations/dagster-powerbi
Category: Business Intelligence

## About this integration

Dagster allows you to represent your Power BI workspace as assets, alongside other your other technologies like dbt and Sling. This allows you to see how your Power BI assets are connected to your other data assets, and how changes to other data assets might impact your Power BI workspace. This also enables you to orchestrate the refreshing of your semantic models, ensuring your Power BI workspace reflects the most current data from upstream sources.

## Installation

```bash
pip install dagster-powerbi
```

## Example

```python
from dagster_powerbi import (
    PowerBIServicePrincipal,
    PowerBIWorkspace,
    build_semantic_model_refresh_asset_definition,
    load_powerbi_asset_specs,
)

import dagster as dg

power_bi_workspace = PowerBIWorkspace(
    credentials=PowerBIServicePrincipal(
        client_id=dg.EnvVar("POWER_BI_CLIENT_ID"),
        client_secret=dg.EnvVar("POWER_BI_CLIENT_SECRET"),
        tenant_id=dg.EnvVar("POWER_BI_TENANT_ID"),
    ),
    workspace_id=dg.EnvVar("POWER_BI_WORKSPACE_ID"),
)

power_bi_assets = [
    build_semantic_model_refresh_asset_definition(resource_key="power_bi", spec=spec)
    if spec.tags.get("dagster-powerbi/asset_type") == "semantic_model"
    else spec
    for spec in load_powerbi_asset_specs(power_bi_workspace)
]

defs = dg.Definitions(
    assets=[*power_bi_assets], resources={"power_bi": power_bi_workspace}
)
```

## About Power BI

**Power BI** is a modern platform for data analytics and visualization. Power BI integrates with various data sources and can be used to create interactive reports, semantic models and dashboards.
