Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Associate Data Practitioner practice bank has 1,156 more like it. Try 10 free: instant score, no account.
An e-commerce company uses Looker to analyze transaction data. A data analyst needs to update the orders.view file to add a new field that calculates the total monetary revenue by summing the values of an existing sale_price dimension.
Which LookML code block correctly defines this aggregate field?
dimension_group: total_sales { type: sum sql: ${TABLE}.sale_price ;; }
dimension_group parameter doesA dimension_group in LookML is a specialized construct used to generate a collection of related time-based dimensions (such as date, week, month, quarter, and year) or duration-based dimensions simultaneously from a single database timestamp or date column.
type: sum parameter is not valid within a dimension_group. Valid types for dimension groups are time and duration.type: time with timeframes: [date, week, month, year] creates multiple individual time dimensions from one database column.type: duration calculates elapsed time intervals (e.g., days or hours) between a start and end timestamp.The objective was to split an order timestamp column into several date and time intervals (e.g., dimension_group: created { type: time timeframes: [date, week, month, year] sql: ${TABLE}.created_at ;; }).
dimension: total_sales { type: sum sql: ${sale_price} ;; }
dimension parameter doesA dimension in LookML represents a row-level column, fact, label, or non-aggregate calculation. Dimensions describe attributes of your data (such as user ID, product status, or dates) and are added to the GROUP BY clause in generated SQL queries.
type: sum is an aggregate type that is only valid within a measure block. LookML validation will produce a syntax error if an aggregation type like sum is declared inside a dimension block.string, number, yesno, tier, distance, and location, but not aggregate calculation types like sum or count_distinct.The requirement called for creating a non-aggregate field, such as a calculated row-level unit price or profit margin before aggregation (e.g., sql: ${TABLE}.price - ${TABLE}.cost ;; with type: number).
measure: total_sales { type: sum sql: ${sale_price} ;; }
measure parameter isIn LookML, a measure defines an aggregate computation or measurable metric across multiple rows of data, such as sums, averages, counts, or distinct counts. While dimensions represent row-level attributes, measures perform SQL aggregations that summarize data when queried.
measure: total_sales tells Looker that this field represents an aggregated calculation rather than a non-aggregate row-level attribute.type: sum instructs Looker to generate a SQL SUM() aggregation in the underlying database query.sql: ${sale_price} ;; syntax uses Looker's substitution operator (${field_name}) to reference the pre-existing sale_price dimension, adhering to sustainable modeling practices and code reusability.GROUP BY and SUM() syntax based on any dimensions selected alongside this measure in an Explore.${sale_price} dimension ensures that if the underlying database column mapping ever changes, only the base dimension definition requires updating.Total Sales appears under the measures section in the field picker, enabling non-technical users to build reports without writing SQL.Declaring an aggregate metric as a measure of type: sum referencing ${sale_price} is the standard, valid LookML pattern for computing numeric totals from dimensions.
explore: total_sales { type: sum sql: SUM(${orders.sale_price}) ;; }
explore parameter doesAn explore parameter defines a starting query point and sets up join relationships between views within a model file (.model.lkml). In SQL terms, an Explore corresponds to the FROM clause of a database query and controls which fields are visible to business users in the Looker Explore UI.
explore declaration does not accept type: sum or a sql aggregation parameter to calculate column totals.join blocks that define how tables relate using parameters like sql_on, type, and relationship.The goal was to expose the orders view in the Looker user interface as an entry point for querying (e.g., explore: orders { ... }).
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated