# Lab 5 - Joined Metrics Queries

This lab teaches you how to join different metrics series to create third series using math operators.

#### Chart of your rate of traffic using join

1. Open a new Metrics window

2. In the first row, define the incoming traffic as the result of rate and sum (to simplify the data). This will become our variable #A, please notice you do not need to declare #A as a variable, just Enter the following:

Metric Net_InBytes, Operators: rate, sum
Note to add an operator to a query select the grey plus sign

3. By virtue of adding this query to the first line, we can refer back to it as #A. Any query on the second line can be referenced as #B and so on.

4. To create a second row, click on the + icon (Add Query) on the far right of Line #A. A second row will be created. define the outgoing traffic as the result of rate and sum (to simplify the data). This will become our variable #B, please notice you do not need to declare #B as a variable. Enter:

Metric Net_OutBytes, Operators: rate sum

5.  Next we need to subtract row #A from #B. To do so we will create a third row, by clicking on the +icon (Add Query) on the far right of Line #B. This will become our variable #C.

6.  Now we want to utilize Advanced Mode to enter the query that will subtract row #A from row #B. To enable Advanced Mode for Row #C, go to the far right and click on the details icon (3 vertical dots) and select Advanced Mode.
NOTE: we will discuss the difference between Basic and Advance query mode when we finish this lab.

7. Once Advanced Mode is enabled for Row #C, enter:
#B - #A

NOTE: The query is case-sensitive, it should be #B-#A not #b-#a.

8. Finally hide the A and B rows, so that your visualization only shows the difference. To do, so click on #A and #B

Terrific - You now have a basic line chart of your rate of traffic over time.

#### Basic Query vs Advanced Query

In the basic query mode, you have a very simple interface where you can select values from drop down list boxes as shown below:

In basic query mode, it is very simple to select the the metric and the filters from the drop down lists and you can add an math operator by clicking on the .

In the Advanced Query mode, you will need to know the query that you want to create.  This was the method we used for our earlier metrics product, but some customers wanted a simpler interface, which helped us develop the Basic Query mode.   Here is an example of the Advanced Query mode, you will get a chance to develop in the Advanced query mode in the upcoming labs.