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

# PlayFab and Microsoft Fabric Real-Time Analytics tutorial

> End-to-end tutorial for integrating PlayFab with Microsoft Fabric Real-Time Analytics to stream game events and explore KPIs in a Power BI dashboard.

This tutorial explains end-to-end steps on how to integrate **PlayFab** and **Fabric Real-Time Analytics** to enable real-time analytics and insights for your game. By following the step-by-step instructions, you will learn how to use PlayFab's Data Connections service to distribute game events to Fabric Real-Time Analytics Database and how to access the Fabric Power BI dashboard to explore key game KPIs. The tutorial includes a sample Power BI dashboard and all the necessary resources to complete the integration.

<iframe src="https://www.youtube.com/embed/lbHjRRz7i1I" width="100%" height="400" allowFullScreen frameBorder="0" />

### Prerequisites

* To successfully complete this tutorial, you need a Microsoft Fabric-enabled [capacity](https://learn.microsoft.com/en-us/fabric/enterprise/licenses#capacity). For a limited time, you can [sign up for the Microsoft Fabric (Preview) trial](https://learn.microsoft.com/en-us/fabric/get-started/fabric-trial).
* A PlayFab developer account. Sign up at [playfab.com](https://developer.playfab.com)
* Microsoft PowerBI Desktop installed. See [Get started with Power BI Desktop](https://learn.microsoft.com/en-us/power-bi/fundamentals/desktop-getting-started#install-and-run-power-bi-desktop)

## Create a Fabric workspace

1. Go to [Microsoft Fabric](https://msit.powerbi.com/home).
2. On the left side navigation bar, select **Workspaces** > **New workspace**.
3. A pane opens on the right side of the screen.
4. Enter a name for the workspace. The only mandatory field is the **Name**. Example: **PlayFabReports**.

<img src="https://mintcdn.com/microsoft-4404708b/MjJ0-cTsb1bpaMcX/images/playfab/data-analytics/learn-data/reports/tutorials/create-workspace-fabric.png?fit=max&auto=format&n=MjJ0-cTsb1bpaMcX&q=85&s=2db6e2c3e95dfe7e0e5d2c3d76ac8c95" alt="Create a Microsoft Fabric Workspace" width="373" height="330" data-path="images/playfab/data-analytics/learn-data/reports/tutorials/create-workspace-fabric.png" />

5. Select **Apply** to save your workspace.

For details, see [Create a workspace - Microsoft Fabric | Microsoft Learn](https://learn.microsoft.com/en-us/fabric/get-started/create-workspaces)

## Create a KQL Database

Once you set up your workspace, the next step is to create a KQL Database, where all your PlayFab events flow into.

1. Go to [Microsoft Fabric](https://msit.powerbi.com/home).
2. On the left side navigation bar, select **Workspaces** > **Your Workspace**.
3. Select **New** > **More Options** > **KQL Database**.
4. Enter a name for the **KQL Database name** field and select **New database** as the **Type**.

<img src="https://mintcdn.com/microsoft-4404708b/MjJ0-cTsb1bpaMcX/images/playfab/data-analytics/learn-data/reports/tutorials/new-kql-database.png?fit=max&auto=format&n=MjJ0-cTsb1bpaMcX&q=85&s=6207df09d76e50a47782669517a64875" alt="Create a KQL Database" width="336" height="263" data-path="images/playfab/data-analytics/learn-data/reports/tutorials/new-kql-database.png" />

5. Select **Create** to complete the Database creation.

To learn more, see [Real-time analytics - Create resources](https://learn.microsoft.com/en-us/fabric/real-time-analytics/tutorial-1-resources).

## Create a Microsoft Fabric Data Connection

After creating the KQL Database, it shows up in your workspace, as shown in the screenshot below.

Now, proceed to create a Data Connection so that all your events can flow into your KQL Database.

<img src="https://mintcdn.com/microsoft-4404708b/MjJ0-cTsb1bpaMcX/images/playfab/data-analytics/learn-data/reports/tutorials/kql-database-overview.png?fit=max&auto=format&n=MjJ0-cTsb1bpaMcX&q=85&s=afd45271058fdd90abad4118af3c65db" alt="KQL Database Overview" width="624" height="261" data-path="images/playfab/data-analytics/learn-data/reports/tutorials/kql-database-overview.png" />

1. Go to [Microsoft Fabric](https://msit.powerbi.com/home).
2. Select **Workspaces** on the left panel and select **Your Workspace**.
3. Copy the **Query URI** by selecting the **Copy** icon next to **Query URI** label.
4. Go to **PlayFab** and sign in on [Game Manager](https://developer.playfab.com/).
5. Select **Data** from the menu on the left.
6. Select the **Data Connections** tab.
7. Select the **New connection** button.
8. On the **Destination type** dropdown, select the **Fabric KQL Database** option.
9. Give your **Data Connection** a name on the **Name** field.
10. Make sure the **Enabled** box is checked.
11. Paste the **Query URI** you got from Fabric into the **Ingestion URI** field.
12. In the **Database** field, enter the name of the **KQL Database** you created in Fabric.
13. Fill the **Table** field with a significant name. Example: **Events**.

<img src="https://mintcdn.com/microsoft-4404708b/MjJ0-cTsb1bpaMcX/images/playfab/data-analytics/learn-data/reports/tutorials/new-data-connection.png?fit=max&auto=format&n=MjJ0-cTsb1bpaMcX&q=85&s=2357a5b6c38a42d5d5d08afd9d78d6a6" alt="New Data Connection" width="1366" height="960" data-path="images/playfab/data-analytics/learn-data/reports/tutorials/new-data-connection.png" />

There's a set of queries at the bottom of the page. In the next section, let's copy these queries into Fabric.

<img src="https://mintcdn.com/microsoft-4404708b/MjJ0-cTsb1bpaMcX/images/playfab/data-analytics/learn-data/reports/tutorials/kql-queries.png?fit=max&auto=format&n=MjJ0-cTsb1bpaMcX&q=85&s=fe0de34e6152fb97dc31f87ae15a7b11" alt="KQL queries" width="1616" height="234" data-path="images/playfab/data-analytics/learn-data/reports/tutorials/kql-queries.png" />

## Bringing it all together

1. Go back to your **KQL Database** page on **Fabric**.
2. Select **Explore your data**.
3. Copy and run each of the queries one by one, selecting the **Run** button at the top of the pane.
4. The result should look like this:

<img src="https://mintcdn.com/microsoft-4404708b/MjJ0-cTsb1bpaMcX/images/playfab/data-analytics/learn-data/reports/tutorials/kql-queries-result.png?fit=max&auto=format&n=MjJ0-cTsb1bpaMcX&q=85&s=ed4740a356a91fc72cb62a713f6cc803" alt="KQL queries result" width="624" height="541" data-path="images/playfab/data-analytics/learn-data/reports/tutorials/kql-queries-result.png" />

5. Go back to the **Data Connections** tab on **Game Manager**.
6. Select **Save**.

## See everything in action

For the best results, follow these steps after completing all the instructions above.

Now, for demo purposes, let's create some new Players in PlayFab's Game Manager, then you should be able to see their data in the Power BI Report.

### Create Players in Game Manager

1. Go to **PlayFab** and sign in on [Game Manager](https://developer.playfab.com/).
2. Select **Players** from the menu on the left.
3. Select the **Players** tab.
4. Select **New player**.
5. Select **Create and login player**.
6. Repeat these steps to create as many players as you want!

### Upload PlayFab's Power BI template to Microsoft Fabric

There are two steps in this process. First, download PlayFab's Power BI template and then upload it to Microsoft Fabric.

#### Download the Power BI template from GitHub

1. Go to [GitHub](https://github.com/) and sign in.
2. Go to the [PlayFabPowerBITemplates](https://github.com/PlayFab/PlayFabPowerBITemplates) repository.
3. Select the **three-dot button** on the top right of the page to download the template.

#### Open the Template on Power BI Desktop and publish to Microsoft Fabric

1. Open **PowerBI Desktop**.
2. Select the **File** tab at the top of the screen.
3. Select **Browse this device** at the bottom left of the screen.
4. Look for the template file (.pbit) you downloaded **select** and **open** it.

<Tip>
  Update the file type to Power BI Template Files (\*.pbit) in the drop down when looking for the downloaded template since it defaults to show \*.pbix files.
</Tip>

5. Fill the connection parameters on the **PlayfabReportTemplate** window.
   * Go to [Microsoft Fabric](https://msit.powerbi.com/home).
   * Select **Workspaces** on the left panel and select your workspace.
   * URI: Copy the Query URI by selecting the **Copy icon** next to the URI field.
   * Database: In the **Database** field, enter the name of the KQL Database you created in Fabric.
   * Enter the table name that you created in [Create a Microsoft Fabric Data Connection](#create-a-microsoft-fabric-data-connection) under **Table**. If you used the example name above, it's **Events**.
6. Select **Load**.
7. Select **Publish** at the top of the page.
8. Select **Save**.
9. Fill out the **Save** this file form. (Only if you haven't saved the file before).
   * Give the Report a significant **Name** for you. Example: **OverviewReport**
   * Select a **Location** to save it to.
   * Select **Save**.
10. Fill out the **Publish** form by selecting your **Microsoft Fabric Workspace**.
11. Select the **Open OverviewReport.pbit in Power BI** link, this opens the template report in Fabric.

Once you complete these steps, select your workspace on Fabric to find the list of database and reports.

<Info>
  The amount of data you see is dependent on when the Data Connection was created. PlayFab doesn't backfill data.
</Info>

## See also

* [Microsoft Fabric terminology](https://learn.microsoft.com/en-us/fabric/get-started/fabric-terminology)
* [Create a workspace](https://learn.microsoft.com/en-us/fabric/get-started/create-workspaces)
* [Navigate to your items from Microsoft Fabric Home page](https://learn.microsoft.com/en-us/fabric/get-started/fabric-home)
* [End-to-end tutorials in Microsoft Fabric](https://learn.microsoft.com/en-us/fabric/get-started/end-to-end-tutorials)


## Related topics

- [Data Connections quickstart](/services/playfab/data-analytics/export-data/data-connection-quickstart.md)
- [Data Connections - Overview](/services/playfab/data-analytics/export-data/data-connection-overview.md)
- [Real-time Analytics Core Concepts](/services/playfab/data-analytics/ingest-data/real-time-analytics-core-concepts.md)
- [Statistics with PlayStream and Telemetry](/services/playfab/player-progression/statistics/statistics-with-playstream-and-telemetry.md)
- [Real money price tracking in Economy v2](/services/playfab/economy-monetization/economy-v2/tutorials/real-money-price-tracking.md)
