# Macro $\_\_timeGroup does not work - ERROR: query error: pq: unbalanced (

**URL:** <https://community.grafana.com/t/macro-timegroup-does-not-work-error-query-error-pq-unbalanced/59722>\
**Category:** PostgreSQL\
**Tags:** postgres, macos, bar-chart-panel, bar-chart\
**Created:** [January 27, 2022, 12:59pm UTC](https://community.grafana.com/t/macro-timegroup-does-not-work-error-query-error-pq-unbalanced/59722 "2022-01-27T12:59:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![maurosuhin](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/maurosuhin/32/21187_2.png) [@maurosuhin](https://community.grafana.com/u/maurosuhin)\
**Post date:** [January 27, 2022, 12:59pm UTC](https://community.grafana.com/t/macro-timegroup-does-not-work-error-query-error-pq-unbalanced/59722/1 "2022-01-27T12:59:54Z")

</div>

- What Grafana version and what operating system are you using?  
8.3.3

- **What** are you trying to achieve?  
Group my rows by date (day)

- **How** are you trying to achieve it?  
Using $\_\_timeGroup(timestamp, ‘1d’),

- What happened?  
For a simple “test query” i get the error ---- db query error: pq: unbalanced (

- What did you **expect** to happen?  
get columns grouped by time

 ![image](https://us1.discourse-cdn.com/grafana/original/3X/5/7/57e3b0efdd46a228931b0a2c8900bab245eb051f.png)

I dont get it why it doesn’t work. I practically used the query suggested in the help and it still does not work. I need this to make work my BAR CHART panel.

![image](https://us1.discourse-cdn.com/grafana/original/3X/c/d/cd972994678579a7b7c47c274a82cdf271e678f4.png)

Can pls someone help me with this. I tried everything and i cant seem to find the solution for this.
