# KPI Tree

The xViz Performance Flow visual offers an advanced KPI Tree, ideal for visualizing interconnected key performance indicators (KPIs) and their relationships.

{% embed url="<https://xviz.com/demos/xviz-performance-flow-kpi-tree/>" %}
Demo report | KPI Tree in Power BI using xViz Performance Flow
{% endembed %}

Leveraging the insights provided by [Power BI's new INFO functions](https://powerbi.microsoft.com/en-us/blog/power-bi-october-2024-feature-summary/#post-28196-_Toc179458536), the xViz Performance Flow visual offers a structured view of interconnected KPIs, dynamically updating the view ensures that users receive the most current information in the report.  With its capability to update as new KPIs are added, the xViz Performance Flow enables teams to stay informed of changes, supporting more effective analysis and management of key metrics across various performance dimensions.

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FSxPHsaKuoQ9RQpLQ3OPl%2FKPI%20Tree%20GIF.gif?alt=media&#x26;token=fb1334f8-0ef5-4073-8278-446cda0d0cee" alt="" width="563"><figcaption><p>GIF 1: KPI Tree</p></figcaption></figure>

### Steps to Configure the KPI Tree in the Performance Flow Visual:

1. Create a new table using the `INFO.VIEW.MEASURES()` function to display information about the model's measures. The table should include columns for each measure's ID, name, its formula or expression, and its current status, indicating whether it’s in a valid or error state, as shown in the image below:

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FxHC4zvkYqXVaATaUVAtm%2Fimage.png?alt=media&#x26;token=0e4d34ec-e5c4-4f6a-97bd-6941e24b9cfc" alt="" width="563"><figcaption><p>Image 1: INFO.VIEW.MEASURES()</p></figcaption></figure>

2. Create a custom column named **"Links"** using the DAX formula below. This column is used as Links to display the relationships between each KPI, helping to identify dependencies among them.

{% hint style="success" %}
Learn more about [xViz Performance Flow | Links](https://docs.xviz.com/performance-management/links)
{% endhint %}

```dax
Links = 
VAR _name = 'Table'[Name]
VAR _parentsID = 
    CONCATENATEX(
        FILTER(
            'Table',
            SEARCH("[" & _name & "]", 'Table'[Expression], 1, 0) > 0 && 'Table'[Name] <> _name
        ),
        'Table'[ID],
        ","
    )
RETURN
    IF(LEN(_parentsID) > 0, _parentsID, BLANK())

```

As a result, the new column will be create as shown in the image below which shows the comma-separated list of IDs of KPIs that each KPI depends on, showing relationships and dependencies between KPIs.

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2F8L8LGBmAY1oUO7X0Lq80%2Fimage.png?alt=media&#x26;token=a8fa774f-551a-4b72-a575-cc4b340ebd11" alt="" width="563"><figcaption><p>Image 2: Links column</p></figcaption></figure>

3. Create a new custom column named **"Parent ID"** using the DAX formula below. This column will take the first ID value from the **Links** column and will be used as the Parent ID in the visual. The Parent ID determines the position of the KPI in the resultant tree structure.

```dax
Parent ID = 
    LEFT(
        'Table'[Links], 
        FIND(",", 'Table'[Links] & ",", 1) - 1
    )
```

As a result, a new column will be created, as shown in the image below, which displays the first ID of the KPI from the Links column.

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FUy3M7vvRaCvX7BWbleGf%2Fimage.png?alt=media&#x26;token=1b36b5bd-9108-45e4-bbc3-dab53a940452" alt="" width="563"><figcaption><p>Image 3: Parent ID column</p></figcaption></figure>

Let's begin with the visualization!

4. Import [xViz Performance Flow](https://appsource.microsoft.com/en-hk/product/power-bi-visuals/xviz.performanceflow-xviz?tab=Overview) from Microsoft AppSource into your report.

{% hint style="success" %}
If this is your first time working with custom visuals, then here are the steps to [import a custom visual from Microsoft AppSource](https://learn.microsoft.com/en-us/power-bi/developer/visuals/import-visual#import-a-power-bi-visual-directly-from-appsource).&#x20;
{% endhint %}

5. Populate the **ID**, **Parent ID**, **Name**, and **Links** columns in the data fields.&#x20;

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FhrvveQOltPX2R51skpQD%2Fimage.png?alt=media&#x26;token=eb6764d3-e915-4885-84df-c567ec03b238" alt="" width="178"><figcaption><p>Image 4: Populate Data columns</p></figcaption></figure>

6. Navigate to the **Map Field** option in the top ribbon and map these newly populated columns to the **Map Field**, as shown in the image below:

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2F5Is5gsLdwWgf5HQVBARu%2Fmap%20field.png?alt=media&#x26;token=370129dc-7a4d-4932-8af5-a86694f8e626" alt="" width="375"><figcaption><p>Image 5: Map newly added column in the Map field</p></figcaption></figure>

7. Conceal the parent-child connectors to focus on the Links:
   1. To improve the appearance of the KPI tree, first navigate to the **Display** option in the top ribbon. Then, in the **Navigation** tab, turn off the expand/collapse button.
   2. Navigate to the Connectors Tab and set the connector color to transparent to hide the connectors to achieving cleaner view.

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FNt1dy3bE17DBEvqqB8X4%2Fimage.png?alt=media&#x26;token=f1357e1e-2207-4556-be41-3a6c8c7fefcc" alt="" width="274"><figcaption><p>Image 6: Expand Collapse button</p></figcaption></figure>

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FLVhrUotMj7Obao8xEnkc%2Fimage.png?alt=media&#x26;token=ac3337bb-05dd-49e7-bdae-4636b32f03ee" alt="" width="276"><figcaption><p>Image 7: Hide connectors</p></figcaption></figure>

8. Now, all the KPIs will be connected to each other based on their Link IDs.&#x20;

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FioIkWXvvpjaPxUhK5gOy%2Fimage.png?alt=media&#x26;token=f64c00de-d21f-4c2b-966b-5e89e5165193" alt="" width="563"><figcaption><p>Image 8: KPIs connected with Links</p></figcaption></figure>

9. To view the connections of any individual KPI, simply click on ellipsis icon in the top-right corner of the node and select the "Show Linked" option, as shown in the image below:

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FZhiqnLSjdkpvXM5uQQH7%2Fimage.png?alt=media&#x26;token=48b0139b-09d5-4b66-b493-4643b32fd56c" alt="" width="417"><figcaption><p>Image 9: Show Linked</p></figcaption></figure>

As a result, it will display the relationships between the selected KPI with the other KPIs, as shown below:

<figure><img src="https://382510089-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIuuIZWiXEx25eV75hmmJ%2Fuploads%2FPkvaAYiRbmZ0ppDshonU%2FKPI%20Tree%20GIF.gif?alt=media&#x26;token=098ea13e-563f-43b8-b094-258709d6283e" alt="" width="563"><figcaption><p>GIF 2: KPI Tree</p></figcaption></figure>

#### Download the sample report file:

{% embed url="<https://xviz.com/demos/xviz-performance-flow-kpi-tree/>" %}
