Question

Most Recent Date

  • 24 March 2021
  • 1 reply
  • 1978 views

I am working with a report that has a date field to X.
This date fields can have multiple values, and created multiple lines for X.

My goal is to have a filter put in place to pull the most recent date for the date field, resulting in only one line for X.

For example; say X has date values for 3/1/21, 3/4/21, & 3/7/21, in my report there are three rows for X to report on each date. What would be the best way to have the report pull only the most recent date (3/7/21)?


This topic has been closed for comments

1 reply

Userlevel 7
Badge +1

In LookML we can’t use min/max measure types with dates but you can mimic this behaviour by using SQL functions in your measure definition like 

measure: max_date {
type: date
sql: MAX(${my_date}) ;;
}

Here is some more information: https://help.looker.com/hc/en-us/articles/360023425454-Max-or-Min-Date-Measure