# Adjust metrics by using the math function in derived fields in Customer Journey Analytics

Explore the potential of using Math functions for creating derived fields in Customer Journey Analytics in this video tutorial. Learn to adjust metrics by removing unwanted components such as tax from totals, and understand the advantages of using derived fields over calculated metrics, including exclusive data view features like de-duplication, bucketing, and attribution. Gain the flexibility to create tailored metrics that align with your analytics needs, enhancing your data-driven decision-making capabilities.

Transcript

Hi, this is Michele, and I’m a technical marketing engineer for the product enablement team. In this video, I’ll demonstrate the value of using the math function when creating derived fields in customer journey analytics. Let’s dive in. In my first example, I’ve been informed that the price total metric in my data view includes the tax amount. I don’t want the tax amount reflected in this metric, so I need a new metric for the adjusted amount. The first thing I’ll do is open data views and then components. It’s worth mentioning that you need proper access to edit data views, so if you don’t see the link at the top, you’ll need to address that first. Once I’m in my data view, I’ll click the Create Derived Field button. This opens the builder where I’ll create my new adjusted total price field in the left column. All available functions to choose from or displayed. I’ll locate math and then drop it to the middle of the builder. Next, I’ll choose the field involved in my formula. I can use the schema Field navigator to locate the field, or I can search for the field at the top. I’ll navigate to the field for my demonstration. I’ll drop this field in the formula bar. At this point, I’ll add my first operator. My options include add, subtract, multiply, divide, and raised to the power. I want the adjusted price total to be subtracted from the current price total. Then in the last part of my formula, I’ll add the sales tax percentage as a static value. Next, I’ll set the order of precedence for the formula by adding parentheses around the part of the equation that should execute first. The green checkmark to the right means my formula syntax is correct. If it wasn’t, I would see a red x. If your Derived field is based on a field that contains current data from the last 30 days, you’ll see a handy output preview in the bottom right. The data type for the field is based on the data type of the field used for the formula. As expected, you can only use numeric fields with the math function. Now I’ll name my field, add a description and save it at the top.

Once it’s saved, I’ll add it to my data view by dropping it to metrics. You may have been wondering why I didn’t use a calculated metric. Using the math function and dry fields has some benefits. For instance, there are additional data view features that aren’t available to calculated metrics such as deduplication, bucketing, and attribution. Now that I’ve added this new derived field to my data view, I’ll go ahead and save my data view. In the workspace project, I have access to the new metric for adjusted total price and the metric selector, and I can use it in my report. In my next example, I’ve been informed that the quantity metric for a specific skew is understated by 10%. I’ll need to use two functions in the derived field builder to produce the corrected metric for the skew. The first rule uses a case one function. In this role, I’ll add the criteria for the specific skew, and then I’ll set a custom numeric value to 10%. If it evaluates to true, otherwise I won’t set a value from this rule. I’ll add a second rule using the math function below the first rule. Now I just need to add the formula for the adjusted quantity. The custom numeric value evaluated in the first rule is automatically added as a field in the math calculation. Next, I’ll name and save my new derived field and add it to metrics, and then save it to the data view. Finally, in my workspace project, I’ll add the new metric to my report to see the result.

Hopefully the math function gives you the flexibility you need to create new metrics on the fly, with all the benefits you get from using a data view in Customer Journey Analytics. Good luck!

For more information, please visit the documentation.

recommendation-more-help

a05d7212-fdba-4b70-a337-d5897f329c68