b2KIT

Looker Studio Query Helper

Build calculated fields, CASE statements, and RegEx formulas for Looker Studio (Data Studio). Preview results with sample data.

Tested tool guide Tested browser tools Checked August 16, 2026

What Looker Studio Query Helper does, with a checked example

Reporting logic can be drafted here before it is added to a Looker Studio data source or chart. The helper assembles calculated fields, searched CASE expressions, and regular-expression formulas, then evaluates them against sample rows supplied by the user. This makes category mappings and text-matching rules easier to inspect. The important distinction is that a successful preview checks the provided examples, not compatibility with every connector, field type, aggregation context, or value in the eventual report.

Worked example

A concrete input and expected output from the current implementation.

Input

Formula:
CASE
  WHEN Sessions >= 100 THEN "High"
  ELSE "Low"
END

Sample data:
Sessions
125
80

Expected output

Sessions | Result
125 | High
80 | Low

The first row satisfies Sessions >= 100, so the CASE expression returns "High". The second row does not satisfy the condition and therefore follows the ELSE branch.

How the result is produced

1

Formula construction

The helper organizes Looker Studio field references, comparisons, return values, CASE branches, and regular-expression conditions into formula syntax. It is suited to rules such as grouping campaign names, labeling traffic bands, or extracting parts of tracking values. The resulting expression is intended for use as a calculated field, subject to the fields and functions available in the destination report.

2

Sample-row preview

Sample values are evaluated against the drafted expression so each row can be compared with its calculated result. This exposes missing CASE branches, incorrect thresholds, and regular expressions that classify test strings unexpectedly. The preview uses only the entered samples and does not inspect a connected Looker Studio schema. Entered reporting data remains in the browser and is not uploaded.

Good uses

  • Map raw campaign names into channel or initiative categories with a CASE expression.
  • Test a regular expression against representative source, medium, URL, or UTM values.
  • Prototype labels for numeric reporting bands before creating a calculated field.

Limits and checks

  • A passing preview covers only the supplied rows; nulls, unexpected spellings, and untested boundary values can still produce different results.
  • REGEXP_MATCH and REGEXP_CONTAINS have different matching behavior, so choosing the wrong function can make a substring rule appear incorrect.
  • Looker Studio can reject an otherwise plausible expression when report fields have incompatible types, different names, or an unsuitable aggregation context.

Common questions

Can I paste the generated formula directly into Looker Studio?

Usually, if the referenced field names, value types, and functions match the destination data source. The preview cannot guarantee that a connector exposes the same schema or permits the expression in the chosen chart context. Check field names exactly and test the formula in Looker Studio before relying on it in a published report.

Does the preview test every value in my report?

No. It evaluates only the sample data entered into the helper. Include representative matches, non-matches, boundary numbers, blank values, and unusual campaign strings when those cases matter. The preview does not query the live report or reveal categories that are absent from the sample rows.

References and verification

The example and behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools