Help & DocumentationGetting DataWorking with Tableau Creating ContentHow to collect data from Tableau (Metric example)

How to collect data from Tableau (Metric example)

This article provides details on how to create a Metric (Dimensioned / Undimensioned) or a Report using a Tableau Plug-in as a data source.


  1. Establish connectivity with Tableau:

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

Use Case: Create a MI element from this Tableau Workbook

We want to use this Tableau workbook to create a Metric in MI. This Metric should show the difference in median price from month to month and should be dimensioned by counties the same way as on this workbook.

1. Start by creating a new element (our example is for a Dimensioned Metric)

Start by creating a new element (our example is for a Dimensioned Metric)
  1. Go to New > Metric 
  2. Define this Metric's Measure.  If you do not see the measure that you want to use, you can create one directly from this drop-down list
  3. Select the Measurement Interval that applies to your element
  4. [For Dimensioned Metrics]: In this example, we are creating a dimensioned Metric, so we specify a Dimension with values sourced from the specific Tableau report. For more details refer to: Create a Dimension with Values collected from Tableau
  5. Click Next: define details

2. Full Editor displays the Data Collection tab

  1. Select the Tableau connection profile serving as a Data Source for this Metric
  2. Set the Data Collection Trigger which is going to initiate data update in this Metric
  3. Tableau Worksheet: Define the Tableau Report to be used for creating Dimension Values in MI. Tableau plugin uses 2 level object hierarchy: [Tableau Workbook name]/ [Tableau Worksheet name]. NOTE: It should be the same Tableau view you have used when creating a Dimension.
  4. You may pre-filter Tableau data before fetching it to your Metric. For more details, see: How to find Filter names in Tableau

3. Constructing a Plugin Command

  1. Input Plugin Command manually (you may reference a table with parameters below) or use a Visual Editor (recommended). The Tableau Query Builder allows constructing commands without the need to learn the plugin syntax and avoiding typos/mistakes
  2. Select Fields and set Aggregation 

 NOTE: Enter the Last Measurement Time when requested.

4. 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 Metrics and Reports only);
  2. measurement DateTime
  3. measurement value


  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

5. Plugin command will be validated and data collected on Save from Visual Editor

If entering plug-in command manually,

  1. Validate plug-in command button
  2. Collect Data 
  3. Enable and Publish

6. A Dimensioned Metric will be displayed in the Viewer

What's next?

Optionally, you can continue to: