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!
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;
;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.