i am using grafana v 9.1.6
when i set the time range to this month, in my bar graph still showing preveous month like this
here’s the query
; with cte as
( select
datename(month,(DATEADD(SS, time, '1970-01-01')))+'-'+cast(year(DATEADD(SS, time, '1970-01-01')) as varchar) as mnth_year
, lead(SS01_TR_BARAT) over( order by DATEADD(SS, time, '1970-01-01')) as Nxt1
, SS01_TR_BARAT
, lead(SS01_TR_TIMUR) over( order by DATEADD(SS, time, '1970-01-01')) as Nxt2
, SS01_TR_TIMUR
, lead(SS02_TR_500KVA) over( order by DATEADD(SS, time, '1970-01-01')) as Nxt3
, SS02_TR_500KVA
, lead(SS03_TR_SELATAN) over( order by DATEADD(SS, time, '1970-01-01')) as Nxt4
, SS03_TR_SELATAN
, lead(SS03_TR_UTARA) over( order by DATEADD(SS, time, '1970-01-01')) as Nxt5
, SS03_TR_UTARA
, lead(SS04_TR_BARAT) over( order by DATEADD(SS, time, '1970-01-01')) as Nxt6
, SS04_TR_BARAT
, lead(SS04_TR_TIMUR) over( order by DATEADD(SS, time, '1970-01-01')) as Nxt7
, SS04_TR_TIMUR
, lead(SS05_TR_2MVA) over( order by DATEADD(SS, time, '1970-01-01')) as Nxt8
, SS05_TR_2MVA
, lead(SS07_TO_TR4) over( order by DATEADD(SS, time, '1970-01-01')) as Nxt10
, SS07_TO_TR4
from
Energy_Trafo
where $__unixEpochFilter(time))
select
mnth_year
, sum(Nxt1-SS01_TR_BARAT) AS SS01_TR_BARAT
, sum(Nxt2-SS01_TR_TIMUR) AS SS01_TR_TIMUR
, sum(Nxt3-SS02_TR_500KVA) AS SS02_TR_500KVA
, sum(Nxt4-SS03_TR_SELATAN) AS SS03_TR_SELATAN
, sum(Nxt5-SS03_TR_UTARA) AS SS03_TR_UTARA
, sum(Nxt6-SS04_TR_BARAT) AS SS04_TR_BARAT
, sum(Nxt7-SS04_TR_TIMUR) AS SS04_TR_TIMUR
, sum(Nxt8-SS05_TR_2MVA) AS SS05_TR_2MVA
, sum(Nxt10-SS07_TO_TR4) AS SS07_TO_TR4
from
cte
group by
mnth_year
thanks for your help