Methods to Create Metrics in Analytical Designer

Date:


The most recent GoodData.CN (1.6.0) now incorporates a Metric Editor in Analytical Designer. With the assistance of this function, you’ll be able to create new metrics utilizing MAQL on your visualizations with out switching contexts — you’ll be able to instantly confirm the brand new metric in visualizations. This weblog put up will present you the fundamental steps of making a metric whereas making a visualization in Analytical Designer. In case you are not acquainted with MAQL, we encourage you to learn the MAQL intro weblog put up.

The picture under is of the demo Logical Information Mannequin (LDM) we are going to use for this text. Probably the most thrilling dataset is Order traces,which collects information from orders that we will analyze.

Demo of the Logical Data Model used for this article

The purpose is to develop a visualization that reveals how profitable the one quarters had been over the 12 months.

4 Steps How To Create New Visualization With Customized Metrics

1. Add Amount Truth and Date Attributes

We are able to merely add the actual fact Amount to the METRICS panel, however this single reality doesn’t inform us quite a lot of invaluable data. Due to this fact, we are going to break it down into quarters by the Date attribute, and for readability, we will additionally add the 12 months Date attribute. The results of this operation ought to be following:

Add Quantity face and Date attribute to the metrics panel

Good, now we will see the Amount reality damaged down by single quarters. What if we wished to know the sum of the Amount in every year? After all, we will sum it up manually, however it isn’t very appropriate, so let’s create a brand new metric for it.

2. Create New Metric

We’ll name the brand new metric Amount BY Yr, and the MAQL expression is as follows:

SELECT SUM({reality/order_lines.amount}) BY {label/date.12 months}

However the place to place this definition of the brand new metric? Happily, we do not need to modify to a different tab, and we will open Metric Editor utilizing the Create metric button within the backside left nook:

Opening of the Metric Editor using the Create metric button

The button opens the Metric Editor, and we will put the MAQL definition in right here:

MAQL definition

Let’s reserve it and instantly confirm our new metric by including it to the METRICS panel:

Verifying the new metric by adding it to the METRICS panel

3. Create Metric Amount/Amount BY Yr

We now have the sum of the Amount in every year, however our unique purpose was to develop a visualization that may present us how single quarters had been profitable. With a brand new metric definition, Amount/Amount BY Yr, we will simply do this.

SELECT SUM({reality/order_lines.amount}) / 
{metric/quantity_by_year}

For the reason that new metric is the ratio between the sum of Amount and Amount BY Yr, we wish to save the brand new metric with the proportion quantity format.

The new metric saved with the percentage number format

Discover that we’re utilizing the metric Amount BY Yr that we created earlier — this can be a highly effective side of MAQL and its reusability.

Let’s save the brand new metric and see it in motion: We are able to merely consider the brand new metric by including it to the METRICS panel:

Evaluation of the new metric

We now have the visualization that reveals us two thrilling metrics: Amount BY Yr and Amount/Amount BY Yr. The metric Amount/Amount BY Yr tells us how profitable the one quarters had been — for instance, the third quarter in 2020 was probably the most profitable, whereas the fourth quarter was the weakest.

(Notice: You might have observed on the screenshots that we’re partially utilizing information from the long run. Keep tuned for a follow-up article on how GoodData leverages time journey to create their demo information units.)

Let’s take a look at the context-awareness of the MAQL language. If we modify the Date attribute to months as an alternative of quarters, the entire visualization will recompute, and we are going to see how the months contributed to the 12 months. The foremost profit is that we do not need to vary something in regards to the metric definition (MAQL). We simply change the context by which it’s being displayed:

Change of the Date attribute to months instead of quarters

4. Create Metric to Test Income

What sort of an evaluation wouldn’t it be and not using a finance report? Let’s create an easy metric that can compute income for us. The metric definition is as follows:

SELECT SUM({reality/order_lines.amount}) * 
(SELECT SUM({reality/order_lines.value}))

Once more, we are going to put the MAQL definition into the Metric Editor in Analytical Designer, and we are going to title the metric Income:

Name the metric Revenue

After saving the metric, we will instantly use it in our visualization:

Revenue metric

Notice: You might need observed that some quarters have totally different income however the identical proportion of Amount/Amount BY Yr metric. There are numerous product costs, however the amount remains to be the identical, which is the explanation for various income.

Abstract

In case you are on this new function, don’t hesitate and take a look at it your self. Test the primary 4 steps from our Getting Began documentation to get to the start line of this text.

The article described the probabilities of the right way to create new metrics in Analytics Designer with out having to modify to a different tab. You’ll be able to instantly confirm the brand new metric in an perception, and if the brand new metric doesn’t work as anticipated, you’ll be able to edit it straight away.

If you wish to be taught extra about MAQL, you’ll be able to comply with our GoodData College MAQL course. For assist and additional information, see our MAQL documentation, group discussion board, and group slack channel.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Share post:

Subscribe

spot_imgspot_img

Popular

More like this
Related

Mastermind teams: Setting the desk

As mentioned in my final article, operating a...

Warren to focus on financial institution crypto choices in US regulator question

Massachusetts Democrat Elizabeth Warren is circulating a letter...

Steps Laptop computer Homeowners Should Take to Mitigate Dangers of Information Loss

Information loss is a rising downside, as corporations...