Create Metric from Tableau

This article provides details on how to create Metric using a Tableau plugin as a data source.

PREREQUISITES:

  1. Establish connectivity to Tableau:

2.     For Dimensioned Metrics: First, create a Dimension with values sourced from Tableau

1. Create New Metric

Access New > Metric > Create New

  1. Select Measured (measurement Interval) that applies to the Element
  2. Enter a descriptive phrase in Name
  3. Assign a Category
  4. [Next: define details]

2. Define Data Collection Details

  1. Choose Tableau connection profile serving as Data Source
  2. Set the Data Collection Trigger which is going to initiate updating information in Metric
  3. Choose Tableau Worksheet that should serve as a basis for Metric
  4. To pre-filter Tableau data before fetching it, click Manage Filters
  5. Construct Plugin command listing the data you would like to include into Metric
    • Build your query in MIQL syntax OR
    • Use Visual Editor. This will automatically validate the command
    • Note that Metrics represent time series data, so one of the columns must contain dates.
  6. [Validate]
  7. [Enable & Publish] to view Metric in Viewer
3. Plugin Commands

The query must include the columns, listed in the hint box to the right of the Plugin command field:

  1. MI dimension (for dimensioned Eelements only);
  2. Measurement DateTime
  3. Measurement value

NOTE: 

  1. Entire field names that contain special characters, aggregation, and commas must be enclosed in quotes (single or double).
  2. It is acceptable to enclose all fields and values in quotes.

[…] + Notation is used to signify that the MIQL parts of a statement are optional/can be repeated. 

Command Description Values Example
fields (dimensions) 'Fields' store the data that is used by Tableau and can be compared to columns in a database table, containing one or more values. Tableau divides data in two major types: dimensions and measures. (NOTE: Make sure not to confuse dimensions in Tableau and Metric Insights Dimensions created for Reports and Metrics.) Dimensions in Tableau are descriptive attributes (typically textual fields or discrete numbers), while measures are the fields that can be measured, aggregated, or used for mathematical operations. Dimension fields are usually used for row or column headings. fields = Channel, Year Month, Total Gross Profit
aggregates It is often required to look at numerical data (which is referred to in Tableau as Measures) in an aggregated form (via mathematical functions, such as summation, average, etc.) Aggregation functions perform a calculation on a set of values and return a single value. For example, if you have 3,000 sales transactions from 50 products in your data source, you might want to view the sum of sales for each product, so that you can decide which products have the highest revenue. sum(field), avg(field), count(field), count(*), min(field), max(field) aggregates = sum(profit), min(salary)
filter Using the 'filter' command you can exclude certain values or a range of values for a field. Several filering conditions can be combined by 'OR', 'AND'. NOTE: This filtering is performed by Metric Insights.
Each filtering condition consists of 3 values: field, corporate operator ( <, >, =< <=, etc.), value (numeric, date or ':last_measurement_time') filter = Year Month == '2016-04-11' AND Avg Sales Per Day > 1000000
external filter Filtering may be also performed externally by Tableau. Tableau handles external filters in the following format:
tableau-filter = (key) == (value)
tableau-filter = Name == 'Bob'
sort You can specify whether you want your field values to be sorted in the ascending or descenting order. ASC, DESC sort = Name ASC
var This command allows creating a new custom field that can be used in all commands listed above. var mon_salary = salary / 12
fields = Name, mon_salary

What's next?

Optionally, you can continue to: