The chart is ordered the way it is because X-axis labels are sorted lexicographically. "2022" comes before "2023" and "F" comes before "J". To put them into date order, you'd have to convert the month field into epoch form using strptime then use fieldformat to specify how it should be displayed. The chart command has a limit option you can use to control how many results are displayed. |dbxquery query="select to_char(received_ts,'YYYY Month') as Month,srv,sum(log_Count) as Total_Log_Count
from gmssp.esm.esm_audit_day
where client_id = ****
AND received_ts>= DATE_TRUNC('month', current_date) - '3 month'::interval
AND received_ts< DATE_TRUNC('month', current_date)
AND SRV!='ignor'
AND SRV!='UNK'
group by srv, month" connection="******"
| eval month = strptime(month, "%Y %B")
| chart limit=top 4 max(total_log_count) by srv month
| fieldformat month = strftime(month, "%Y %B")
... View more