Is there a way to filter a field based on a dashboard filter? I’ve been checking out templated filters, but I’m not sure if it covers this use case.
Scenario:
So when the users sets the date via a dashboard filter to “2022-9-2”, we not only want the table to be filter the table’s “date” to the inputted date, but we also want it to filter the `week_date` to “2022-8-29”.
Solved! Go to Solution.
After researching this, I don’t believe this possible, at least not for a date filter. Instead, I am going to implement 1 of the below solutions:
SELECT CAST(week AS STRING) AS week FROM UNNEST(GENERATE_DATE_ARRAY(DATE_TRUNC('2000-1-1', WEEK(MONDAY)), CURRENT_DATE(), INTERVAL 1 WEEK)) AS week ORDER BY 1 ASC
This generates a list of Monday dates since January 3rd, 2000 (the 1st Monday of the year 2000). This dimension will also have both `can_filter` and `hidden` set to no.
After researching this, I don’t believe this possible, at least not for a date filter. Instead, I am going to implement 1 of the below solutions:
SELECT CAST(week AS STRING) AS week FROM UNNEST(GENERATE_DATE_ARRAY(DATE_TRUNC('2000-1-1', WEEK(MONDAY)), CURRENT_DATE(), INTERVAL 1 WEEK)) AS week ORDER BY 1 ASC
This generates a list of Monday dates since January 3rd, 2000 (the 1st Monday of the year 2000). This dimension will also have both `can_filter` and `hidden` set to no.