Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to sum AmpH from Date Out starting at 05:00:00 AM of the first day to 05:00:00 AM of the next day.
Hi @Paknanarn23 ,
You could use this to get 1 date for all values between 05:00:00 this day and 05:00:00 the next day. If the date is later then 12:00:00 PM then it will substract 1 day for the timestamps before 05:00:00.
TIMESTAMP(DATE(IF(TIME(DATE_OUT-DAYSTART(DATE_OUT))>=TIME('05:00:00') ,DAYSTART(DATE_OUT),DAYSTART(DATE_OUT)-1),'DD-MM-YYYY')+TIME('05:00:00'),'M/DD/YYYY h:mm:ss TT') AS GroupByDate
This is the result:
Can you explain how you are getting these numbers and how do you want to sum them?
Hi Tresesco,
I got this sum from Database, it's a value fetched from Database at all.
where I want to sum the Amph values from Date Out 5:00 AM of the first selected date to 5:00 AM of the last selected date.
I am still not clear about your 5 a.m. part. Could you explain with a selection case?
It's not a choice. But it is a condition for sum(AmpH) that if the time is 5am, sum(ampH) will come out in each Cu Tank
For example, if CU TANK = 26, you will get this value.
The time will start from 6am on January 30, 2023 until 4am on January 31, 2023
Hi @Paknanarn23 ,
You could use this to get 1 date for all values between 05:00:00 this day and 05:00:00 the next day. If the date is later then 12:00:00 PM then it will substract 1 day for the timestamps before 05:00:00.
TIMESTAMP(DATE(IF(TIME(DATE_OUT-DAYSTART(DATE_OUT))>=TIME('05:00:00') ,DAYSTART(DATE_OUT),DAYSTART(DATE_OUT)-1),'DD-MM-YYYY')+TIME('05:00:00'),'M/DD/YYYY h:mm:ss TT') AS GroupByDate
This is the result: