Displaying Year/Month in Time Series

Hello,

I am working with Grafana and have a time series query that returns data in the format of year and month (YYYY/MM). However, when I attempt to display this data, I encounter the error message: “Data is missing a time field.”

Could anyone assist me with configuring Grafana to properly handle and display time series data with only the year and month, without including the day? Any advice on how to resolve this issue or adjust the time field settings would be greatly appreciated!

Thank you in advance for your help!
Best regards,


you could try a bar chart?

I tried, but the graph display is not properly filled; it does not reflect the selected time range.

please answer these questions

  1. what is your datasource?
  2. what data type are mois and annee columns (int, varchar)?
  3. What does your query look like

1-SQL Server
2- int
3-SELECT
CAST(CONCAT(MC.annee, ‘-’, RIGHT(‘0’ + CAST(MC.mois AS VARCHAR(2)), 2)) AS CHAR(7)) AS [Date],
MC.croissance_nette
FROM
[CroissanceMensuelleNette] AS MC
ORDER BY
MC.annee, MC.mois;

1 Like

it is missing a filter so it will show everything

;with CroissantDelicieux
as
(
select 21 croissance_nette, 4 mois, 2023 annee union
select 34, 4, 2023 annee union
select 115, 6, 2023 annee union
select 133, 12, 2023
)
SELECT convert(datetime,CONCAT(MC.annee,'-',RIGHT('0' + CAST(MC.mois AS VARCHAR(2)), 2),'-01')) AT TIME ZONE 'UTC' AT TIME ZONE 'Central European Standard Time' as [time],
       MC.croissance_nette
FROM CroissantDelicieux AS MC
ORDER BY MC.annee, MC.mois;

not sure why you opted for the design of having year and month separately.

1 Like