# Part 2 - Metrics

### Hint #1

In the first section of solving this part, we going to split up the output from Part 1 (use an Output tool at the end of Part one above) into two streams - one for the Gross Profit Margin (GPM, top) and one for the Operating Profit Margin (OPM, bottom). &#x20;

<div data-full-width="true"><figure><img src="/files/F4Hbc8vKQRhe99bZ6FGw" alt=""><figcaption><p>The first section of the model</p></figcaption></figure></div>

We start with a Filter to remove all the irrelevant rows - we only need Sales and Cost of Sales to caluclate GPM and Sales and >EBIT< to calculate OPM. We remove some unnecessary columns with Change Columns tools.&#x20;

The complexity comes from the Transpose. Later on in the model, we need to make a formula to calculate of margins - we need the data (e.g. Sales and Cost of Sales) to be on the same row to do so. The Transpose is the first step to achieving that. We begin transforming our value columns (Y2018, Y2019, Y2020) to rows keeping the Account constant. The Transpose is made to do that.  See the config below.

<figure><img src="/files/QAw6mHR3zbCskhf6JWLw" alt=""><figcaption><p>Transpose configuration</p></figcaption></figure>

###

***

### Hint #2

The second section of this part is about calculating our metrics. We do that with a Compare tool and a Calculate. The Compare tool is what really helps us achieve what we want. The entire second section looks like this:

<div data-full-width="true"><figure><img src="/files/7c5aaStGEphsLKR8jmTa" alt=""><figcaption><p>The second section of part 2</p></figcaption></figure></div>

The Compare tool helps us move data between rows, i.e. vertically in our dataset. Take a look below at the configuration of the first compare (Tool ID 144):

<div data-full-width="true"><figure><img src="/files/rIuYcMTanRxN1MWbIHYs" alt=""><figcaption><p>The Compare tool and the output</p></figcaption></figure></div>

Let's begin with the output column *prev\_Value.* This one is fetching the previous cell of the column *Value.* So the number from *Value* column on row 1 will show up in the number of *prev\_Value* on row 2. \
\
We also use the Option Setting "Group By" to *reset* our calculation everytime we see a new year in the column *Columns.* In doing all of this, we move the Sales and the Cost of Sales to the same row - and now we can calculate with it!\
\
The calculations - Tool ID 145 and 159 -  are faily simply. You can see the formula in the first screenshot here. Afterwards we remove the rows without any calculation with the Filter tools.

***

### Hint #3

The final step we simply use a Combine tool to merge the two streams of data back together. We Combine using an Inner Join on the Year column. It looks like this:

<div data-full-width="true"><figure><img src="/files/aav9neOaVVuarPrde4f3" alt=""><figcaption><p>The final section</p></figcaption></figure></div>

In totality, our full model looks like this:

<div data-full-width="true"><figure><img src="/files/uG3NeawvwBSSjrjxsqeO" alt=""><figcaption><p>The full model</p></figcaption></figure></div>


---

# 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://resources.less.tech/less-tech/exercises/automated-financial-analysis/hints/part-2-metrics.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.
