Trailing data for Q


I think we can only set the absolute value for the date field in the filter. If that’s true, what should I do if let’s say if I type TTM, then Q will know to look at the order_day field and filter for 12 month until the latest complete month (so Sep-Aug if I do it today). TIA!

Do you not want twelve months? If so you can filter at the dataset level and that should exclude it from Q.

1 Like

Hi @luvis1189 thanks for your question on Q! Today we are limited to only absolute date ranges in Q Named Filters, as you’ve discovered, but we are adding more Named Filter support soon. In the meantime, you should be able to accomplish the same thing by creating a Calculated Field in the Topic that computes the number of months the date is from now, like:

dateDiff({yourDateField}, now(), 'MM')

Then you can create a numeric Named Filter on that column and set the filter condition to <= 12. You can name that Named Filter “ttm” and now when someone asks a question mentioning “ttm” it will filter the result based on dates in the last 12 months from now.

You will likely also want to “exclude” the calculated field that you created from the Topic (using the toggle slider) just so that Q doesn’t get confused in trying to pick the calculated field or the filter. You are still allowed to refer to calculated fields that are excluded in other things like Named Filters, Named Entities, and other Calculated Fields in the Topic.