$__timeGroup macro doesn't work with sql function convert_tz

  • What Grafana version and what operating system are you using?
    v9.4.3 MySQL

  • What are you trying to achieve?
    I want to use $__timeGroup macro and convert_tz function in the same query to change display date to local time (UTC → Europe/Paris)

  • How are you trying to achieve it?
    Using the query below :
    SELECT
    convert_tz(min(ts),‘Europe/Paris’,‘UTC’) as time,
    TagName as metric,
    count(TagValue) /(($__interval_ms / 1000) / 600) as value
    FROM
    conso
    WHERE $__timeFilter(ts)
    Group by $__timeGroup(ts, $interval,NULL),metric
    order by time asc

  • What happened?
    When i group by day, the display date in the tooltip is “DD-MM-YYYY 02:00:00” instead of “DD-MM-YYYY 00:00:00”. It doesn’t take into account the convert_tz function. After investigation, it seems that it’s the “NULL” in the $__timeGroup macro that’s causing the problem. When i write $__timeGroup(ts, $interval), i have the right date format.

  • What did you expect to happen?

Date format taking account my local timezone (“DD-MM-YYYY 00:00:00”)

Do you have any idea ? Thank you