Hi I am having trouble displaying data on my bar chart the way I want it to be See screenshot below of my table. I don’t know why the last two row is broken down the way it is. is there away to have it display it as one row instead of two row of the same date?
Here is a screenshot of my Bar chart
here is my query
SET ARITHABORT OFF
SET ANSI_WARNINGS OFF
SELECT
CONVERT(DATETIME, AVG(CONVERT(FLOAT, Timestamp))) as Time,
-- ---This Count the amount of time the State == 3000 Meaning that unit is ON
-- COUNT(CASE WHEN IoTData.Value =30000 and IoTData.Name ='State'
-- THEN IoTData.Value
-- END) *(0.0027777777777778) as "Total h2 Generation Time",
-- ---This Count the amount of time the xv333 == 1 Meaning that "xv333" is Energized sending H2 to Vent
-- COUNT(CASE WHEN IoTData.Value = 1 and IoTData.Name ='xv333'
-- THEN IoTData.Value
-- END)*(0.0027777777777778) as "Send to Vent Time",
((AVG(CASE WHEN IoTData.Value >400 and IoTData.Name in ('PSA_I','PSB_I','PSC_I','PSD_I','PSE_I','PSF_I','PSG_I','PSH_I')
THEN IoTData.Value
END))*(COUNT(CASE WHEN IoTData.Value >400 and IoTData.Name in ('PSA_I','PSB_I','PSC_I','PSD_I','PSE_I','PSF_I','PSG_I','PSH_I')
THEN IoTData.Value
END) *100 )*0.0000373)*(0.0027777777777778) as "Total H2 KG Generate" ,
(((AVG(CASE WHEN IoTData.Value >400 and IoTData.Name in ('PSA_I','PSB_I','PSC_I','PSD_I','PSE_I','PSF_I','PSG_I','PSH_I')
THEN IoTData.Value
END))*(COUNT(CASE WHEN IoTData.Value >400 and IoTData.Name in ('PSA_I','PSB_I','PSC_I','PSD_I','PSE_I','PSF_I','PSG_I','PSH_I')
THEN IoTData.Value
END) *100 )*0.0000373)*(0.0027777777777778))-(((AVG(CASE WHEN IoTData.Value >400 and IoTData.Name in ('PSA_I','PSB_I','PSC_I','PSD_I','PSE_I','PSF_I','PSG_I','PSH_I')
THEN IoTData.Value
END))*(COUNT(CASE WHEN IoTData.Value >400 and IoTData.Name in ('PSA_I','PSB_I','PSC_I','PSD_I','PSE_I','PSF_I','PSG_I','PSH_I')
THEN IoTData.Value
END) *100 )*0.0000373)*(0.0027777777777778) *(COUNT(CASE WHEN IoTData.Value = 1 and IoTData.Name ='xv333'
THEN IoTData.Value
END)) *(0.0027777777777778)) as "H2 KG Sent to Product",
((AVG(CASE WHEN IoTData.Value >400 and IoTData.Name in ('PSA_I','PSB_I','PSC_I','PSD_I','PSE_I','PSF_I','PSG_I','PSH_I')
THEN IoTData.Value
END))*(COUNT(CASE WHEN IoTData.Value >400 and IoTData.Name in ('PSA_I','PSB_I','PSC_I','PSD_I','PSE_I','PSF_I','PSG_I','PSH_I')
THEN IoTData.Value
END) *100 )*0.0000373)*(0.0027777777777778) *(COUNT(CASE WHEN IoTData.Value = 1 and IoTData.Name ='xv333'
THEN IoTData.Value
END)) *(0.0027777777777778) as "H2 KG Sent To Vent"
FROM
[dbo].[IoTData]
WHERE
Device = 'PEM_Sun' and Name in('xv333','State','PSA_I','PSB_I','PSC_I','PSD_I','PSE_I','PSF_I','PSG_I','PSH_I') and
--Timestamp BETWEEN '2022-06-07T00:00:00Z' AND '2022-06-08T23:59:59Z'
$__timeFilter(Timestamp)
--Group by [Timestamp]
Group by datepart($OrderBy , Timestamp)