Hi,
My problem is that time series chart shows data/bars which doesn`t exists.
You can see that this record doesn`t exits in Dataset Editor.
Data comes from Named query:
SELECT
SUM(meterReading) AS usage,
DATEADD(MINUTE, DATEDIFF(MINUTE, 0, readingDate), 0) AS readingNoSec
INTO
#grouped
FROM
[PLGROmaintenanceSystem].[dbo].[BMS_energyMeters]
WHERE
meterName IN ('RGnN1_AN1-RGnN1_QSZ1', 'RGnN2_AN1-RGnN2_QSZ2')
GROUP BY
DATEADD(MINUTE, DATEDIFF(MINUTE, 0, readingDate), 0)
ORDER BY
readingNoSec DESC
SELECT
b.readingNoSec AS Od,
a.usage - b.usage AS Zużycie
INTO
#tempTable1
FROM
#grouped AS a
INNER JOIN
#grouped AS b
ON
a.readingNoSec = DATEADD(MINUTE, 15, b.readingNoSec ) --cut off secounds
AND
b.readingNoSec >= :startDate
AND
b.readingNoSec <= :endDate
ORDER BY
b.readingNoSec
SELECT
DATEADD(MINUTE, 30, (SELECT MAX(Od) FROM #tempTable1)) AS Od,
0.0 AS Zużycie
INTO
#tempTable2;
SELECT * FROM #tempTable1
UNION ALL
SELECT * FROM #tempTable2
ORDER BY Od;
Query add reading from two electricity meters in specified time, rounded to minutes.
Does someone know what`s wrong?