수식에서 다른 필드의 ID를 참조할 때 $를 접두사로 붙입니다. 대상
예를 들어 ID 필드가 t_celsius이면
$t_celsius입니다.
계산된 필드의 경우 Type
계산된 필드에서 Type가 지원되지만 수식의 출력은
해당 Type의 예상 형식과 일치합니다.
예를 들어 수식의 경우는 다음과 같습니다.
"HYPERLINK($url, $description)"
Type는 HYPERLINK여야 합니다.
계산된 필드의 경우 aggregation
수식에 집계가 포함된 경우 aggregation를 다음과 같이 설정해야 합니다.
AUTO입니다. 함수 목록의 type 열을 확인하여 함수가 있는지 확인합니다.
집계를 반환합니다. 수식에 집계가 포함되지 않은 경우 집계를 설정하세요.
NONE님에게 전송됩니다.
수식
aggregation
"SUM($cost) / SUM($units)"
AUTO
"$cost + $units"
NONE
스키마의 계산된 필드 예
functiongetSchema(request){varcc=DataStudioApp.createCommunityConnector();varfields=cc.getFields();vartypes=cc.FieldType;varaggregations=cc.AggregationType;fields.newDimension().setId('date').setName('Date').setDescription('Date of measurement').setType(types.YEAR_MONTH_DAY);fields.newMetric().setId('t_celsius').setName('Temperature (Celsius)').setDescription('Temperature in Celsius').setType(types.NUMBER).setAggregation(aggregations.NONE);fields.newMetric().setId('t_fahrenheit').setName('Temperature (Fahrenheit)').setDescription('Temperature in Fahrenheit').setFormula('$t_celsius / 5 * 9 + 32').setType(types.NUMBER).setAggregation(aggregations.NONE);fields.newMetric().setId('average_temperature (Celsius)').setName('Average Temperature (Celsius)').setDescription('Temperature in Fahrenheit').setFormula('AVG($t_celsius)').setType(types.NUMBER).setAggregation(aggregations.AUTO);fields.newMetric().setId('average_temperature (Celsius)').setName('Average Temperature (Celsius)').setDescription('Temperature in Fahrenheit').setFormula('AVG($t_celsius / 5 * 9 + 32)').setType(types.NUMBER).setAggregation(aggregations.AUTO);fields.newDimension().setId('feels_like').setName('Feels Like').setDescription('What it feels like outside.').setFormula('CASE WHEN $t_celsius < 0 THEN "Freezing" WHEN $t_celsius > 40 THEN "Too warm" ELSE "Not bad" END').setType(types.TEXT);return{'schema':fields.build()};}
[null,null,["최종 업데이트: 2025-07-25(UTC)"],[[["\u003cp\u003eThe \u003ccode\u003eformula\u003c/code\u003e field property enables the addition of calculated fields to your connector's schema using supported functions.\u003c/p\u003e\n"],["\u003cp\u003eWhen referencing other fields within a formula, prefix their \u003ccode\u003eID\u003c/code\u003e with a \u003ccode\u003e$\u003c/code\u003e symbol (e.g., \u003ccode\u003e$fieldName\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eType\u003c/code\u003e property for calculated fields should align with the formula's output format (e.g., \u003ccode\u003eHYPERLINK\u003c/code\u003e for hyperlink formulas).\u003c/p\u003e\n"],["\u003cp\u003eFormulas using aggregation functions require setting the \u003ccode\u003eaggregation\u003c/code\u003e property to \u003ccode\u003eAUTO\u003c/code\u003e, while those without aggregations should use \u003ccode\u003eNONE\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eA comprehensive function list and documentation for specific functions like \u003ccode\u003eCASE\u003c/code\u003e, \u003ccode\u003eCAST\u003c/code\u003e, \u003ccode\u003eTODATE\u003c/code\u003e, and others are available for reference.\u003c/p\u003e\n"]]],[],null,["# Using calculated fields in schema\n\nThe [`formula`](/looker-studio/connector/reference#field.formula) field property can be used to add [calculated fields](https://support.google.com/looker-studio/answer/6299685) to your\nconnector's schema.\n\nThe full list of functions that are supported in formulas can be found at\n[Function List](https://support.google.com/looker-studio/table/6379764). Additionally, there is further documentation for:\n\n- [CASE](https://support.google.com/looker-studio/answer/7020724)\n- [CAST](https://support.google.com/looker-studio/answer/7280720)\n- [TODATE](https://support.google.com/looker-studio/answer/7037300)\n- [HYPERLINK](https://support.google.com/looker-studio/answer/7431836)\n- [IMAGE](https://support.google.com/looker-studio/answer/7570489)\n- [REGEXP_EXTRACT](https://support.google.com/looker-studio/answer/7050487)\n- [REGEXP_MATCH](https://support.google.com/looker-studio/answer/7064476)\n- [REGEXP_REPLACE](https://support.google.com/looker-studio/answer/7067058)\n\n| **Caution:** These function names cannot be used as the `ID` for a field.\n\nWhen referring to another field's `ID` in a formula, prefix it with a `$`. For\nexample, if your field `ID` is `t_celsius`, it should be referred to as\n`$t_celsius` in the formula.\n\n`Type` for calculated fields\n----------------------------\n\n`Type` is supported for calculated fields, but the output of the formula must\nmatch the expected format for that `Type`.\n\nFor example, for the formula: \n\n \"HYPERLINK($url, $description)\"\n\nThe `Type` should be `HYPERLINK`.\n\n`aggregation` for calculated fields\n-----------------------------------\n\nIf your formula involves an aggregation, the `aggregation` should be set to\n`AUTO`. Check the `type` column in the [Function List](https://support.google.com/looker-studio/table/6379764) to see if a function\nreturns an aggregation. If your formula does not involve an aggregation, set it\nto `NONE`.\n\n| Formula | `aggregation` |\n|------------------------------|---------------|\n| `\"SUM($cost) / SUM($units)\"` | `AUTO` |\n| `\"$cost + $units\"` | `NONE` |\n\nExamples of calculated fields in schema\n---------------------------------------\n\n function getSchema(request) {\n var cc = DataStudioApp.createCommunityConnector();\n var fields = cc.getFields();\n var types = cc.FieldType;\n var aggregations = cc.AggregationType;\n\n fields.newDimension()\n .setId('date')\n .setName('Date')\n .setDescription('Date of measurement')\n .setType(types.YEAR_MONTH_DAY);\n\n fields.newMetric()\n .setId('t_celsius')\n .setName('Temperature (Celsius)')\n .setDescription('Temperature in Celsius')\n .setType(types.NUMBER)\n .setAggregation(aggregations.NONE);\n\n fields.newMetric()\n .setId('t_fahrenheit')\n .setName('Temperature (Fahrenheit)')\n .setDescription('Temperature in Fahrenheit')\n .setFormula('$t_celsius / 5 * 9 + 32')\n .setType(types.NUMBER)\n .setAggregation(aggregations.NONE);\n\n fields.newMetric()\n .setId('average_temperature (Celsius)')\n .setName('Average Temperature (Celsius)')\n .setDescription('Temperature in Fahrenheit')\n .setFormula('AVG($t_celsius)')\n .setType(types.NUMBER)\n .setAggregation(aggregations.AUTO);\n\n fields.newMetric()\n .setId('average_temperature (Celsius)')\n .setName('Average Temperature (Celsius)')\n .setDescription('Temperature in Fahrenheit')\n .setFormula('AVG($t_celsius / 5 * 9 + 32)')\n .setType(types.NUMBER)\n .setAggregation(aggregations.AUTO);\n\n fields.newDimension()\n .setId('feels_like')\n .setName('Feels Like')\n .setDescription('What it feels like outside.')\n .setFormula('CASE WHEN $t_celsius \u003c 0 THEN \"Freezing\" WHEN $t_celsius \u003e 40 THEN \"Too warm\" ELSE \"Not bad\" END')\n .setType(types.TEXT);\n\n return { 'schema': fields.build() };\n }\n\n| **Key Point:** `aggregation` is set to `AUTO` for formulas involving aggregations, and `NONE` otherwise."]]