How can I drill down in Looker?

Hello! Let’s suppose that I have a table with 2 columns: date and sales. Then, I created a graph, where the X axis is date and Y is the sales. Is there a way to control how date is grouped just like a drill down in Datastudio? Example: if a click in a button, the date will be organized by week, or month, or quarter, or year.

Hi Bruno,

If you are looking for timeframes dimensions (field picker availae with time dimensions) you should implement a dimension group in X column (date column)

Dimension group syntax in LookML

If you are looking for a dashboard with a dynamic filters that impact a visualization, you will need:

  1. looker parameter object.

Place your looker parameter in the view lookML.

For instance:

  parameter: timeframe_picker {
    label: "Date Granularity"
    type: string
    allowed_value: { value: "Date" }
    allowed_value: { value: "Week" }
    allowed_value: { value: "Month" }
    default_value: "Date"
  }

2.(depending on your SQL vendor the syntax may change) a new dimension using a SQL CASE-WHEN logic .

For instance:

dimension: dynamic_timeframe {
    type: string
    label_from_parameter: timeframe_picker
    sql:
    CASE
    WHEN {% parameter timeframe_picker %} = 'Date' THEN CONVERT(varchar(120),${orders.created_date})
    WHEN {% parameter timeframe_picker %} = 'Week' THEN CONVERT(varchar(120),${orders.created_week})
    WHEN{% parameter timeframe_picker %} = 'Month' THEN CONVERT(varchar(120),${orders.created_month})
    END ;;
  }

Notice that curly brackets “{% %}” are part of Liquid - Looker functionality.

Here is a full example which explains how to create a looker dynamic field based on looker parameters .

Regards,

Leo

1 Like

Thank you so much! :slight_smile:

1 Like

You are welcome!

If you agree, you can close this topic.

Best Regards,

Leo