Relative queries

2 posts, 0 answered
  • Will Simpson
    get2will avatar
    1 posts
    11 May 2012
    25 Feb 2014
    Is there a way to do a relative query in QB2?  For instance, at an instream detector I want to filter on any tag detected more than a year after its initial release date.  Can that be done?  I could sort it in a spreadsheet or database, but that would take a considerable amount of time.  Thanks.
    Link to this post
  • Nicole Tancreto avatar
    63 posts
    21 Feb 2012
    26 Feb 2014 in reply to get2will
    This is possible using the view filter and metrics. Metrics are a different kind of report object than attributes in that they contain values that can be used in calculations and are often the product of aggregations. Some of the metrics that are available to use include minimum and maximum Release Date and Obs Date.

    To answer your specific question, you can use a Release Date metric to create a derived metric that evaluates to the Release Date + 12 months on the fly in your report grid. You can then use that derived metric in the view filter to find all interrogation detail records with an Obs Date > (Release Date + 12 months).

    I have created and published a video tutorial that demonstrates how to accomplish this. Please see the last video, titled 09. Advanced Filtering with Metrics, on the video tutorials page.

    If you have any questions after viewing the video, please post them here.
    Link to this post