My Looker chart is using a ‘DateTime’ field in the Date Range Control. This field is in the format ‘YYYY-Mon-DD HH:MM:SS’ (e.g. 2024-Apr-30 14:53:25). In addition to the date level filtering, I would to be able to filter at the timestamp level (HH:MM).
-
How may I use the ‘DateTime’ field to filter at the hour and/or minute level granularity?
-
Is it possible to have a preselected default for timestamp? For instance, something like selecting a default value for the Date Range Control (Today, or 1 week, etc.). My use case is to be able to display results for the last 2 hours by default.
Please let me know if addition info is needed.
Thank you!
1 Like
Hello @invisible ,
For both of your questions, I believe you can consider the following:
- Looker filter expressions - these are an advanced way to filter Looker queries, and this page describes how to write them. In the Explore section of Looker you can use them by adding a filter and choosing the matches (advanced) option. They are also used in LookML for elements that take a filter parameter.
- conditionally_filter - lets you define a set of default filters that users can override if they apply at least one filter from a second list that you define. This parameter is typically used to prevent users from accidentally creating very large queries that may be too expensive to run on your database.
- always_filter - lets you require users to include a certain set of filters that you define. You also define a default value for the filters. Although users may change your default value for their query, they cannot remove the filter entirely.
Hope this helps.
1 Like
Thank you, @maricarp ! I looked into those filters and I do not see an option to use LookML. I did a bit more digging and I am not sure if I am understanding this correctly – I am using ‘LookerStudio’ (basic license, not pro). Can LookML be used with LookerStudio, or do I need a pro license to use it?
Are there any other options in the basic Looker studio that would allow time level filtering granularity, and setting those defaults?
Thank you!
1 Like