Skip to content

Timegroup Granularity via Variable: Errors on Quarter #295

@jjspratt

Description

@jjspratt

What happened:
Query failure on $__timeGroup(column, $Granularity) when Quarter selected.

Granularity defined as

Week = 1w, Month = 1M, Quarter = 1Q

What you expected to happen:
I expect to see results similar to date_trunc('quarter', column). This is what I experience when selected Week or Month.

How to reproduce it (as minimally and precisely as possible):

  1. create custom variable:
    Week : 1w, Month : 1M, Quarter : 1Q
  2. add a panel
  3. Select Redshift as source
  4. Add following as custom query:
with time as (select GETDATE() as "test")


select 
time.test
,$__timeGroup(time.test, $Granularity)
from time
  1. select 'Table View'
  2. Change variable from Week to Month to Quarter
  3. Upon selecting Quarter see error text:
    Could not apply macros: error parsing interval 1Q

-->

Screenshots

If applicable, add screenshots to help explain your problem.
-->

Anything else we need to know?:

Environment:

  • Grafana version: Cloud
  • Plugin version: 1.18.0
  • OS Grafana is installed on: N/A
  • User OS & Browser: Mac Sonoma 14.5 / Chrome

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions