Help & DocumentationConnecting To Data Sources Sourcing Data from 1010dataCreating 1010data macro code for your 1st Basic Metric

Creating 1010data macro code for your 1st Basic Metric

This will show you how to create a very simple Metric - a visualization that measures sales over time.

1. Build your macro code

Build your macro code

1.1. Formatting date to mm/dd/yyyy

Formatting date to mm/dd/yyyy

Insert a willbe in the Edit Actions screen to reformat the date to a mm/dd/yyyy format. Here is the example code: <willbe name="Date" value="date" format="type:date4y"/>

1.2. Select Rows to show only recent data.

Select Rows to show only recent data.
  1. Use is greater than in the drop down - this will be used on the Metric Insights side.
  2. Regardless of the actual dates you are analyzing, choose a recent date to limit row count.

2. Build a Tabulation

Build a Tabulation

3. Now we have Daily Sales for Total Month.  

Now we have Daily Sales for Total Month.  

4. Copy Macro Code to paste into Metric Insights.

Copy Macro Code to paste into Metric Insights.

Metric Insights takes raw macro code from 1010data. Copy the 1010data macro code out of the Edit Actions window to paste into Metric Insights.

To see how to build a Metric from scratch, click the following this link:

 

5. Paste your code into Metric Insights Metric Editor

Paste the code into the Macro Code box in the Metric Editor.

6. Remove table name note at the beginning of the code, and paste table into table name field.

  1. Paste the Table Name into the Table Name field & remove table note from code.
  2. Validate your command to verify code. If your statement is valid, the statement box is green; if there are any errors, the box is colored in red and errors will be explained in the field below.

NOTE: You may replace your date selection in the code with :last_measurement_time. :last_measurement_time bind variable will be substituted at run-time with the last data point collected for the metric.