CASE
WHEN Order Items Sale Price < 20 THEN "0-20"
WHEN Order Items Sale Price < 40 THEN "20-40"
WHEN Order Items Sale Price < 60 THEN "40-60"
WHEN Order Items Sale Price < 80 THEN "60-80"
WHEN Order Items Sale Price < 100 THEN "80-100"
WHEN Order Items Sale Price < 120 THEN "100-120"
WHEN Order Items Sale Price < 140 THEN "120-140"
WHEN Order Items Sale Price < 160 THEN "140-160"
WHEN Order Items Sale Price < 180 THEN "160-180"
WHEN Order Items Sale Price < 200 THEN "180-200"
ELSE "200+"
END
问题排查
如果您在使用 Looker Studio 创建计算字段时遇到错误,请确保您要求的是可以通过计算字段实现的结果,而不是查询或图表的结果。
提供反馈
生成计算字段后,Looker Studio 会提示您提供有关该字段的反馈。如果生成的字段看起来正确无误,请点击thumb_upRate positive(表示“好评”)图标。如果生成的字段看起来不正确,或者您想就此功能提供其他反馈,请点击thumb_down负面评价“不喜欢”图标。请附上您输入的提示以及 Looker Studio 创建的公式。我们会为开发团队收集此类反馈,但不会将其用于训练 Looker 中的 Gemini 模型。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-25。"],[],[],null,["# Create calculated fields with Gemini assistance\n\n\u003cbr /\u003e\n\n|\n| **Preview**\n|\n|\n| This product or feature is subject to the \"Pre-GA Offerings Terms\" in the General Service Terms section\n| of the [Service Specific Terms](/terms/service-terms#1).\n|\n| Pre-GA products and features are available \"as is\" and might have limited support.\n|\n| For more information, see the\n| [launch stage descriptions](/products#product-launch-stages).\n\nThis documentation describes how to use [Gemini in Looker](/looker/docs/studio/gemini-in-looker-overview) to help you create calculated fields by letting you describe the kinds of fields that you want.\n\nLooker Studio prompts you to describe the fields that you'd like to create. Based on your input, Looker Studio suggests a formula for a [calculated field](/looker/docs/studio/about-calculated-fields) by using fields from your data source along with Looker Studio functions and operators.\n\nGemini in Looker is a product in the [Gemini for Google Cloud](/gemini/docs/overview) portfolio that provides generative AI-powered assistance to help you analyze and gain valuable insights from your data.\n\nLearn [how and when Gemini\nfor Google Cloud uses your data](/gemini/docs/discover/data-governance).\n\nThis page is intended for report editors in Looker Studio.\n\nBefore you begin\n----------------\n\nTo use this Gemini in Looker feature, you need to fulfill the following requirements:\n\n- You must be a user under a [Looker Studio Pro subscription](/looker/docs/studio/looker-studio-pro-subscription-overview). Looker Studio Pro licenses are [available at no cost](/looker/docs/admin-panel-platform-lsp) to Looker users.\n- To be able to create chart-specific calculated fields, you must be an editor of the report.\n- [Field Editing in Reports](/looker/docs/studio/edit-fields-in-your-reports) must be enabled in the data source.\n- Gemini in Looker must be [enabled for your Looker Studio Pro project](/looker/docs/studio/enable-and-disable-gemini-in-looker-for-looker-studio).\n\nCreate a calculated field with Gemini assistance\n------------------------------------------------\n\n| As an early-stage technology, Gemini for Google Cloud\n| products can generate output that seems plausible but is factually incorrect. We recommend that you\n| validate all output from Gemini for Google Cloud products before you use it.\n| For more information, see\n| [Gemini for Google Cloud and responsible AI](/gemini/docs/discover/responsible-ai).\n\nTo create a calculated field with Gemini assistance, follow these steps:\n\n1. When you're [writing a calculated field](/looker/docs/studio/about-calculated-fields), click the **Help me write a calculated field** icon in the bottom right of the field editor.\n2. If you have not begun writing a calculated field, Looker Studio prompts you to select a suggested prompt or to describe the kind of calculated field that you want to create.\n - To select one of the suggested prompts, click the prompt.\n - To describe the kind of calculated field that you want to create, write a description and then click **Create** . See the **Sample prompts** section for examples of descriptions that you can write.\n3. If you have already begun writing a calculated field, Looker Studio will use that formula as context. Describe how you would like to change the calculated field, and then click **Create** .\n - To edit your original prompt, hover over the prompt and click the **Edit** icon. Edit your prompt, and then click **Update.**\n - To remove the previous formula from Looker Studio's context, hover over the formula and click the **Reset** icon.\n - To refine your formula, click **Refine** . Next, provide Looker Studio with additional information about your formula, such as adding or removing a bucket, or adding another field to a concatenation. Finally, click **Create**.\n4. To add the generated formula to your calculated field definition, click **Apply**.\n5. To save your field definition, click **Save**.\n\nTo exit the formula generation dialog at any point without saving your changes, close the dialog by clicking the **X** in the top right corner or by clicking outside of the dialog.\n\n### Limitations\n\nNote the following limitations on calculated field creation:\n\n- Gemini in Looker can help you create only calculated fields that meet Looker Studio criteria of [what you can do with calculated fields](/looker/docs/studio/about-calculated-fields).\n- Looker Studio won't suggest [parameters](/looker/docs/studio/parameters) or a [NATIVE_DIMENSION](/looker/docs/studio/nativedimension) when it suggests a calculated field.\n- The [Looker connector](/looker/docs/studio/limits-of-the-looker-connector#support-of-looker-studio-features) supports only [some functions](/looker/docs/studio/limits-of-the-looker-connector#expandable-1) for calculated fields.\n\n### Information used by Gemini in Looker\n\nWhen you create a calculated field with Gemini assistance, Looker Studio uses the following information to generate formulas:\n\n- The prompt that you write to instruct Looker Studio to create or edit a field\n- The formula definition for any field that you change or refine\n- The schema of the underlying data source\n\nSample prompts\n--------------\n\nTo get you started, here are some sample prompts for different kinds of fields:\n\n- Try entering the following prompt:\n\n Merge city and state like City, State\n\n Looker Studio may return a field definition like the following: \n\n CONCAT(Users City, \", \", Users State)\n\n- Try entering the following prompt:\n\n bucket sale price in groups of 20\n\n Looker Studio may return a field definition like the following: \n\n CASE\n WHEN Order Items Sale Price \u003c 20 THEN \"0-20\"\n WHEN Order Items Sale Price \u003c 40 THEN \"20-40\"\n WHEN Order Items Sale Price \u003c 60 THEN \"40-60\"\n WHEN Order Items Sale Price \u003c 80 THEN \"60-80\"\n WHEN Order Items Sale Price \u003c 100 THEN \"80-100\"\n WHEN Order Items Sale Price \u003c 120 THEN \"100-120\"\n WHEN Order Items Sale Price \u003c 140 THEN \"120-140\"\n WHEN Order Items Sale Price \u003c 160 THEN \"140-160\"\n WHEN Order Items Sale Price \u003c 180 THEN \"160-180\"\n WHEN Order Items Sale Price \u003c 200 THEN \"180-200\"\n ELSE \"200+\"\n END\n\nTroubleshooting\n---------------\n\nIf you get an error while creating a calculated field with Looker Studio, make sure that you are asking for a [result that you can achieve with calculated fields](/looker/docs/studio/about-calculated-fields), rather than the results of a query or a chart.\n\nProvide feedback\n----------------\n\nAfter generating a calculated field, Looker Studio will prompt you to provide feedback on the field. If the generated field looks correct, click the thumb_up **Rate positive** thumbs-up icon. If the generated field looks incorrect, or if you'd like to provide other feedback on this feature, click the thumb_down **Rate negative** thumbs-down icon. Include the prompt that you entered as well as the formula that Looker Studio created. This feedback is collected for our development team and is not used to train the Gemini in Looker model.\n| **Note:** Gemini in Looker is in preview with limited support. We encourage you to share your feedback to help us improve. To report bugs or issues, reach out to [Looker Support](/looker/docs/best-practices/looker-support-details) and be sure to include the following details:\n|\n| - A clear description of the problem and the expected behavior\n| - Steps to reproduce the issue\n| - Any additional relevant details\n\nRelated resources\n-----------------\n\n- [Gemini for Google Cloud overview](/gemini/docs/overview)\n- [Gemini in Looker](/gemini/docs/looker/overview)"]]