← Files TableauARCHIVED FILE

skills/tableau-workbook-authoring/resources/examples/calculated-field.json

1.14 KB · Oct 3, 2026 · 06:23 UTC

↓ Download file

{
  "_description": "Add a calculated field (measure) to a datasource",
  "_feature": "calculated-field",
  "_usage": "Insert this node as a child of the target datasource node. Change name, caption, formula, role, type, and datatype to match your field.",
  "example": {
    "type": "column",
    "attrs": {
      "name": "[Calculation_20260303120000_001]",
      "caption": "Profit Ratio",
      "role": "measure",
      "type": "quantitative",
      "datatype": "real"
    },
    "children": [
      {
        "type": "calculation",
        "attrs": {
          "formula": "SUM([Profit]) / SUM([Sales])",
          "class": "tableau"
        }
      }
    ]
  },
  "notes": {
    "name_format": "[Calculation_YYYYMMDDHHMMSS_NNN] — must be unique within the datasource",
    "role_values": ["dimension", "measure"],
    "type_values": ["nominal", "ordinal", "quantitative"],
    "datatype_values": ["string", "integer", "real", "boolean", "date", "datetime"],
    "dimension_example": {
      "role": "dimension",
      "type": "nominal",
      "datatype": "string",
      "formula_example": "IF [Profit] > 0 THEN 'Profitable' ELSE 'Unprofitable' END"
    }
  }
}

SHA-256: 7b6c4094dbfdce0b6d175ac29174fc278c25a1a86f042e938ed7a6201516cc07