Skip to Main Content
Preset Feature Feedback
Status Gathering Feedback
Categories New feature
Created by Vítor Ávila
Created on Feb 7, 2022

Ability to filter for multiple Time Columns on a Dashboard

What is the problem or goal the end user is trying to solve or accomplish?

Users would like to have the ability to filter multiple time columns on a dashboard, which is currently not possible.

How are they solving it currently?

There isn't a workaround available at the moment.

What is the recommended solution by the Customer?

Implement the ability to specify to which column a Time Filter is being applied, so that multiple filters can be added. This should also be possible with Jinja (to have different/independent {{from_ddtm}} and {{to_ddtm}} on the query).

  • Attach files
  • Scott Hildebrand
    Reply
    |
    Feb 21, 2022

    Here is another example of where only a single time range filter is being used, but I need to take the results of this statement divided by the results from another time Period which would come from another Time Range Filter.


    SELECT

    date_created as xdate,

    id,

    1.00000 as netbooking,

    total_true_margin as ttm,

    site_slug,

    reward_program_slug,

    product_name

    FROM rti.reservation_stats

    WHERE date(date_created) >= TO_TIMESTAMP(' {{ from_dttm }} ', 'YYYY-MM-DD HH24:MI:SS.US')

    AND date(date_created) < TO_TIMESTAMP(' {{ to_dttm }} ', 'YYYY-MM-DD HH24:MI:SS.US')

    UNION ALL

    SELECT

    date_cancelled as xdate,

    id,

    -1.00000 as netbooking,

    total_true_margin*(-1.00000) as ttm,

    site_slug,

    reward_program_slug,

    product_name

    FROM rti.reservation_stats

    WHERE date(date_cancelled) >= TO_TIMESTAMP(' {{ from_dttm }} ', 'YYYY-MM-DD HH24:MI:SS.US')

    AND date(date_cancelled) < TO_TIMESTAMP(' {{ to_dttm }} ', 'YYYY-MM-DD HH24:MI:SS.US')

  • Scott Hildebrand
    Reply
    |
    Feb 9, 2022

    Thank you for any upvotes for this!

    Regarding the JINJA - ideally this can be implemented in the CUSTOM SQL tab of the Metrics section (NOT virtual dataset).
    We need one Metric to use TWO different dashboard Time Range filters which will affect the calculations.

    Example below BOLD would be replaced with JINJA code

    AVG(CASE WHEN

    date_created > (GETDATE() - interval '30 day')

    AND

    date_created <= GETDATE()

    THEN total_revenue

    ELSE NULL

    END)

    /

    AVG(CASE WHEN

    date_created > (DATE('2021-10-03') - interval '30 day')

    AND

    date_created <= DATE('2021-10-03')

    THEN total_revenue

    ELSE NULL

    END)

  • +5