I am using a dimension as a filter in a dashboard. I am also using the same dimension as a visual in the same dashboard. Below is the LookML for the dimension I have created,
dimension: DataLastUpdatedAt {
label: "Data Last Updated At"
type: string
sql: CONCAT(CAST(DATE_DIFF(CURRENT_DATETIME(),${StartDate_raw},MINUTE) AS STRING)," minutes ago");;
}
This dimension returns the time difference in minutes between the Start Date (DateTime) and CurrentDateTime.
The visual using the dimension gets updated with the latest data when I "Clear cache and refresh" the dashboard but not the filter using the visual. Please see screenshot below,
Below is my filter settings
I am expecting the default value in the filter to change when the corresponding dimension changes when the data is refreshed. Please do correct me if I am wrong.
Can someone please help?
Hey! I'm thinking that maybe it has something to do with the dimension being a type string? If you're trying to filter other fields on the dashboard that are time-based then the type string could interfere with that.
Try using a dimension of type: duration instead. Duration dimensions let you define an interval between two times/dates. By defining this as a time based dimension it should be easier to filter.
dimension_group: DataLastUpdatedAt {
label: "Data Last Updated At"
type: duration
intervals: [minute]
sql_start: CURRENT_DATETIME() ;;
sql_end: ${StartDate_raw}
}