Unlock the power of your data in the cloud! Get hands-on with Google Cloud's core data services like BigQuery and Looker to validate your practical skills in data ingestion, analysis, and management, and earn your Associate Data Practitioner certification!
Prepare and test your skills
Prepare and test your skills
Worked example. The correct answer is already marked and every option is explained below, so there is nothing to select here. To answer questions yourself, start the free trial.
A data team is updating an existing LookML view file (orders.view) to support new reporting requirements. The view already defines a base dimension for customer IDs:
dimension: user_id {
type: number
sql: ${TABLE}.user_id ;;
}
The business requires a new aggregate field that calculates the distinct count of customers who placed orders within the last 30 days. Following LookML modeling best practices for maintainability, how should this field be declared in the view file?
In LookML, a measure is a field that computes an aggregate calculation across multiple rows of data, such as counts, sums, averages, or distinct counts. A dimension represents a row-level attribute or fact. When building data models, LookML uses the substitution operator (${...}) to reference database columns or other LookML fields in a modular, maintainable hierarchy.
type: count_distinct directs Looker to generate the appropriate SQL aggregation (such as COUNT(DISTINCT ...)) across rows.filters parameter applies a conditional filter directly to the calculation (e.g., filters: [created_date: "30 days"]), ensuring only qualifying rows are aggregated.${user_id} instead of ${TABLE}.user_id ensures that if the underlying database column name ever changes in the future, developers only need to update the base dimension's sql parameter in one location.${field_name} creates a single reference point for the physical column in the data model.type: count_distinct into dialect-specific SQL functions without manual SQL string manipulation.Declaring an aggregate metric as a measure and referencing the base dimension with ${field_name} follows core LookML modeling standards. It separates row-level dimensions from aggregated metrics while keeping the code maintainable and DRY (Don't Repeat Yourself).
Keep the momentum going with these hand-picked practice scenarios
Want more questions like this?
Get a free certification question every week.