Write Looker expressions with Gemini assistance

This documentation page describes how to use Gemini assistance to write Looker expressions for table calculations and custom fields.

Gemini in Looker provides generative AI-powered assistance to help you work with your data.

Learn how and when Gemini for Google Cloud uses your data.

Before you begin

To use Gemini to write expressions, note the following requirements:

Use Gemini to write an expression

To use Gemini for assistance in creating a Looker expression, follow these steps:

  1. When creating a table calculation or custom dimension, click Help me write an expression with Gemini.

    The table calculation dialog showing the Help me write an expression link.

  2. In the Help me write an expression dialog, describe the table calculation or custom dimension that you want to write using natural language.

  3. Click Create.

  4. Gemini will display the expression that's created based on your description. You can click Refine to add to or modify your description, or Apply to add the expression to your table calculation or custom dimension definition.

Tips for using the Gemini Expression Assistant

Here are some tips for using Gemini to write table calculations or custom dimensions:

  • For best results, write your prompts in American English. See the Gemini for Google Cloud limitations documentation for more information.
  • The Help me write an expression panel does not retain context from a previous prompt in the conversation and does not retain prompts across logins and refreshes.
  • When you use an expression that was suggested by Gemini, always test your new fields in an Explore.

Sample prompts

Here is an example using the Help me write an expression option that asks Gemini to create a table calculation that shows the percentage change from one row to the next. Then this example further refines the table calculation to include formatting.

Enter the first prompt in the Describe your expression field:

Add a field that shows percentage change from one row to the next

Gemini returns a suggested expression:

Gemini returns a suggested expression to show percentage change from one row to the next.

Then, click Refine to ask Gemini to add formatting:

Now format the output in percentages and append an up arrow when the percentage is above zero or a down arrow when the percentage is below zero

Gemini updates the suggested expression:

Gemini returns a new expression that adds formatting.

Click Apply, and the new table calculation is created:

The new table calculation is added to the Explore.

Provide feedback

You can provide feedback for the generated expression in the Help me write an expression panel. If the generated expression looks correct, click the thumb_up thumbs-up icon. If the generated expression looks incorrect or isn't what you expected, click the thumb_down thumbs-down icon.