# Using the Template

## One-Time Setup (Required)

{% hint style="warning" %}
The template requires a Windows Operating System with PowerBI Desktop, Python, and the pyfair Python library installed
{% endhint %}

1. **Download Microsoft PowerBI Desktop**

If you don't already have it, you'll need to download the [free Microsoft PowerBI Desktop application.](https://www.microsoft.com/en-us/power-platform/products/power-bi/downloads)

2. **Install the Python Programing Language**

The template runs Python code to perform the risk analysis. You'll need to install Python if you don't already have it.&#x20;

You can download Python from the [Python website.](https://www.python.org/)

3. **Install python libraries**

You'll need the following Python libraries installed. It's recommended to use the pip installer to easily install them.

* [Pandas](https://pandas.pydata.org/) is a software library for data manipulation and analysis. Pandas offers data structures and operations for manipulating numerical tables and time series. To import into Power BI, Python data must be in a [pandas data frame](https://www.tutorialspoint.com/python_pandas/python_pandas_dataframe.htm). A data frame is a two-dimensional data structure, such as a table with rows and columns.
* [Pyfair](https://github.com/Hive-Systems/pyfair) is a software library for computing FAIR monte carlo simulations. This is the core library performing the computations for the risk modeling.

```
pip install pandas
pip install pyfair
```

4. Enable Python Scripting

You'll need to enable python scripting in the PowerBI Desktop Application before using the template.&#x20;

Go to File > Options and settings > Options > Python scripting.&#x20;

<figure><img src="/files/sq7zLZ4px44pJ1X7L0o4" alt=""><figcaption></figcaption></figure>

Ensure you have the correct home directory selected and select "ok".

For troubleshooting and additional information see[ "Run Python scripts" in the Microsoft Documentation.](https://learn.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts)

## 2. Entering Your Scenario Inputs

When you open the Power BI template, you’ll see a **parameter popup** prompting you to enter values for your scenario. These inputs will populate the report and drive the risk simulation.

Here’s a breakdown of each input and how to format it:

### 1. Threat Event Frequency (TEF)

*Represents how often a threat event is expected to occur annually.*

* Format: **Low, Most Likely (Mid), High**
* Example: `1, 10, 20`&#x20;

### 2. Vulnerability

*The probability that a threat event results in loss.*

* Format: **Decimal (0 to 1)**
* Example: `0.35` (represents 35%)

### 3. Primary Loss Magnitude

*The expected loss directly resulting from the threat event.*

* Format: **Low, Most Likely (Mid), High**
* Example: `25000, 100000, 500000`&#x20;

### 4. Secondary Loss Event Frequency (SLEF)

*How often a secondary loss is expected to occur annually.*

* Format: **Low, Most Likely (Mid), High**
* Example: `1, 10, 20`&#x20;

### 5. Secondary Loss Magnitude (SLEM)

*The estimated magnitude of secondary losses (e.g., regulatory fines, reputational damage).*

* Format: **Low, Mid, High**
* Example: `10000, 50000, 150000`&#x20;

## After Entering Inputs

Once you've entered your parameters and loaded the template:

* The model will automatically simulate outcomes using **10,000 iterations**.
* The outputs will be visualized in the report pages

<figure><img src="/files/tFryQN0CkJwnVvF5bvem" alt=""><figcaption></figcaption></figure>

## Troubleshooting

### Query references other queries or steps, so it may not directly access a datasource

When loading your model inputs, you may receive multiple errors stating the query references other queries or steps. This error is due to the privacy levels of the sources and query references in order to reduce duplicative python code.&#x20;

<figure><img src="/files/sliTKWdSCAfqMLGUuNxG" alt=""><figcaption></figcaption></figure>

To address it, click on "close". Then navigate to File > Options > Current File > Privacy > Ignore the Privacy Levels > OK.&#x20;

<figure><img src="/files/huYzspFXCScoVoQo0MbJ" alt=""><figcaption></figcaption></figure>

Then click on "refresh" under the "Home ribbon".&#x20;

<figure><img src="/files/7PGfysxkWqQcr4245xNC" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.securemetrics.io/using-the-template.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
