I am trying to make a weekly graph which will start from Monday but Grafana starts by default from thursday. I don’t want to make changes in the server. Is there another way to fix it .
I use only Grafana connected with a database
Example (sample code query)
SELECT
UNIX_TIMESTAMP(StartTime) DIV 604800 * 604800 AS “time”,
count(idAllFaults) AS “No sync- Retail”
FROM AllFaults
WHERE
StartTime BETWEEN FROM_UNIXTIME(1621851996) AND FROM_UNIXTIME(1622456796) AND
( TTSymptom = ‘Δε συγχρονίζει’ AND FLAG=‘False’)
GROUP BY 1
ORDER BY UNIX_TIMESTAMP(StartTime) DIV 604800 * 604800
SELECT
$__timeGroupAlias(StartTime,7d),
count(idAllFaults) AS “No sync- Retail”
FROM AllFaults
WHERE
$__timeFilter(StartTime) AND
( TTSymptom = ‘Δε συγχρονίζει’ AND FLAG=‘False’)
GROUP BY 1
ORDER BY $__timeGroup(StartTime,7d)
You are taking Unix Time and finding the remainder after dividing by the number
of seconds in one week.
That means your starting point is going to be 00:00:00 Thursday because that
is when Unix Time started on 1st January 1970.
If you really want to do that calculation (time DIV 604800 * 604800) and get
results starting on a Monday, try subtracting 259200 from the timestamp first,
before the DIV.