Dimension control in Looker? (not Looker Studio)

Hello! Does the dimension control functionality from Looker Studio exist in Looker? I want to have visualization tiles where the dashboard user can select which dimension the data is grouped on.

I'm aware there's a beta to enable Studio in Looker but was wondering if the functionality exists natively in Looker.

0 1 186
1 REPLY 1

You can do this in Looker, but you would need to implement it in LookML. You could create a parameter that allows the front end user to populate it with one of the other dimensions in your view. I asked Google's market-leading AI, Gemini, to come up with some sample code and it looks reasonable (although I have not tested it):

view: parameterised_grouping {
  sql_table_name: your_database.your_table ;; # Replace with your actual database and table

  parameter: grouping_dimension {
    type: string
    allowed_value: {
      label: "Product Category"
      value: "product_category"
    }
    allowed_value: {
      label: "Region"
      value: "region"
    }
    allowed_value: {
      label: "Customer Segment"
      value: "customer_segment"
    }
  }

  dimension: product_category {
    type: string
    sql: ${TABLE}.product_category ;;
  }

  dimension: region {
    type: string
    sql: ${TABLE}.region ;;
  }

  dimension: customer_segment {
    type: string
    sql: ${TABLE}.customer_segment ;;
  }

  dimension: dynamic_grouping {
    type: string
    sql:
      CASE
        WHEN {% parameter grouping_dimension %} = 'product_category' THEN ${product_category}
        WHEN {% parameter grouping_dimension %} = 'region' THEN ${region}
        WHEN {% parameter grouping_dimension %} = 'customer_segment' THEN ${customer_segment}
        ELSE NULL  # Optional: Handle case when no parameter is selected
      END ;;
    label_from_parameter: grouping_dimension # Dynamically changes the label based on the parameter
  }

  measure: total_sales {
    type: sum
    sql: ${TABLE}.sales ;;
  }
}
Top Labels in this Space
Top Solution Authors