Report for every 1 hour

I wanted to take out a report for every one hour, the count, i used trunc(x_date,'hh24') to take the report, but the problem is, for few hours there wont be any count, so i have to substitute with zero there, any ideas ?,

Hi,
If you want to make sure all hours appear in the result set, even if they don't appear in the table, then outer-join to a table (or, in the example below, a sub-query) where you know they do exist.
For example, if your table_x has columns entry_dt and amt, and you want results for every hour of the day, you can do somehting like this:
WITH     all_hours     AS
     SELECT     TO_CHAR ( SYSDATE + (LEVEL / 24)
               , 'HH24'
               )     AS hr
     FROM     dual
     CONNECT BY     LEVEL     <= 24
SELECT       a.hr
,       COUNT (entry_dt)     AS cnt
,       NVL ( AVG (amt)
           , 0
           )               AS avg_amt
FROM           all_hours  a
LEFT OUTER JOIN      table_x    x      ON   a.hr = TO_CHAR (entry_dt, 'HH24')
GROUP BY  a.hr
ORDER BY  a.hr
;COUNT never returns NULL, so you don't have to use NVL with COUNT.
For other aggregate functions (such as AVG) you do need to use NVL to get 0 instead of NULL.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using.

Similar Messages

  • CUIC Custom Report for Business Hours for Weekdays Only

    Customer wants a UCCX custom report which we are building with CUIC Premium.  The one criteria we are having issue with deals with the ability to selects days of the week BUT only with specific hours of the day for each of the days selected.  So customer want to be able to run the report for Monday to Friday but from 8AM to 5PM for each of those days, so essentially during business hours only.  The built in Absolute Date Range does not work because that would run the report starting Monday at 8AM until Friday at 5PM.
    Thanks,
    Dan

    dicharville,
    Our 3rd party solution lets you produce historical reports by "shifts" by each day.  In your case each day agents having the shift of 8 - 5.  Let me know if you would like to discuss in detail how our solution can accomplish this and more.
    Thanks,
    Ron Reif / [email protected]
    651-635-2822

  • Profit & Loss Report for Every month

    Hi,
    Can anyone tell me is it possible to get the report on Profit & Loss Report to every month for each PROJECT? If possible please let me know the T.Code.
    Regards,
    Mohan.

    Hi
    try this tcodes
    S_ALR_87013572 - Project results
    CJIF - Results Analysis
    Also F.08 is not balance sheet report because we don't assign Financial statement version there
    Regards
    Tanmoy

  • Dyamic execution of report for every month and data through mail.

    Dear Friends,
    We are using ECC6.00 With EHP4. My requirement is to send the list of pending notifications with the list details as appearing in transaction QM10. Every month i am supposed to change the from date and to date for example 01.07.2010 to 31.07.2010 for the month July.
    How can i make system calculate the from and to date for every month and send mail.
    I can schedule the  job using SM36 but how to make system calculate the from and to date dynamically for every month. i.e., for august system should calculate date 01.08.2010 to 30.08.2010 automatically as the next month is reached.
    Experts help required.
    Regards,
    M.M

    1. You need to create a variant.
    2. In this blank out the date and give all the required values which will filter for the Pending nofitications like notificaiton type, status, etc.
    3. Then click save.
    4. When you click save it will give you an option to save as variant.
    5. Now in the Variant Attributes screen give the variant name/meanting
    6. In the below you will get a "objects for selection screen)
    7. In the same you will get the filed name calle d" notification date"/
    8. Here Move the curson to the righ side you will find the selection variable, change to D-Dyanamic date calcuation  and after that right side you will see one more column for the name of variable(input using only f4)
    9. Here press f4,
    10. then  ypou get a pop up for selection varaible. there first Put "I: for current date and also 'I" for hte Current date +/- ??? days
    in this give 30 days.
    11. You can also use other function her.e
    Now once the variant is created then you have to schedule a job for this program + variant in the sm36 and in the distribution list
    you need to mention the email
    check and let me know for the feedback
    reg
    dsk

  • Report for Timesheet Hours charged to Overhead Codes

    How does one generate a report that lists Timesheet Hours charged by each Resource to an Overhead Code for a given Timesheet Period?
    Thanks!

    Hi,
    you can use Tcode se38for running this report .
    Or else give a Tcode - PTARQ
    It gives you the total functionalities of Leave Requests.
    Its the sap standard interface provided to test the functionalities in R/3 side .
    Hope this helps .
    Reward if found useful .
    regards
    SureshP.

  • WPA/WPA2 secured wireless connection fails for two minurtes for every hour of use.

    Hello.
    I have a brand new ThinkPad T500 2055-A16 with Windows Vista Business. I have a WiFi connection problem. It is not a signal strength problem, as it doesn't work even if I place the computer right next to the access point with no other wireless equipment near by.
    None of my other computers experience this problem. I even bought another ThinkPad T500 2055-A16 at the same time as this one, and that does not have the problem either. The problem is when I connect to a network using WPA2-PSK or WPA-PSK. The connection works fine for half an hour, an hour or two hours, but then without warning, the connection is lost and it is not possible to reconnect for half a minute, a minute or two minutes. The exact times vary. When I switch the network to use WEP or no encryption, everything works fine. But I don't like to use no encryption and I cannot use WEP because I have other computers in my home which does not support WEP.
    I had this problem right from the beginning the first time I used the computer. I have tried many things like disabling power management or IPv6 and other things suggested by my ISP, but it did not change anything, so I switched them back to their default value. I have also tried to update the driver for the Intel(R) WiFi Link 5100 AGN card, but that didn't help the problem. The problem became slightly less annoying when I uninstalled Access Connections, because Vista would then reconnect as soon as it could, whereas I in Access Connections would have to continuously press the connect button until it succeeded. But the problem is still a real pain.
    Some pieces from the Windows Event Viewer, which I think looks interesting (these occur regularly at exactly the same timestamps as when the connection is lost):
     Profile match: Success
     Pre-Association: Success
     Association: Success
     Security and Authentication: Fail
    0x00048005 and 0x0003800b
    Result of diagnosis: Problem found
     Issue referred to: L2Sec Helper Class
    I also see the following message on my access point's log, which also occur at exactly the times when the connection is lost:
    1x:00216b4d7ee6:logout
    (The number match the MAC address of my computer)
    The only other message which is logged on my Access Point when all log options are enabled is "Time initialized by NTP server".
    How can I solve this problem so that I can have undisrupted wireless Internet access?

    Edit: Actually my other ThinkPad T500 2055-A16 also fails in the same way, but my ThinkPad SL500 2746-9BG and my Medion laptops works fine, also running Vista.

  • Item Price in report for every transaction

    Hi Guys.i am using the below queries for Stock report and i am getting the desired output  except the price calculation.
    In that query it is calculated like max(price) or avg(price) but instead of that i need the item price for that particular transaction  and also i need the prices for opening stock , goods issue, goods receipt and closing stock seperately in each column .
    pls provide me the updated query.
    Declare @FromDate Datetime
    Declare @ToDate Datetime
    Declare @Group nvarchar(10)
    Declare @Whse nvarchar(10)
    Set @FromDate = (Select min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]')
    Set @ToDate = (Select max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]')
    Set @Group = (Select Max(s2.ItmsGrpCod) from dbo.OITB S2 Where S2.ItmsGrpNam = 'Group B')
    Set @Whse = (Select Max(s3.Warehouse) from dbo.OINM S3 Where S3.Warehouse = '03'  )
    Select
    @Whse as 'Warehouse',     
    a.Itemcode,
    max(a.Dscription) as 'Description',MAX(a.Price) as 'Price',
    sum(a.[Opening Balance]) as [Opening Balance],
    sum(a.[IN]) as [Receipt],
    sum(a.OUT) as [Issue],
    ((sum(a.[Opening Balance]) + sum(a.[IN])) - Sum(a.OUT)) as Closing,
    ( MAX(a.Price) *  ((sum(a.[Opening Balance]) + sum(a.[IN])) - Sum(a.OUT)) ) as ClosingValue
    from(
    Select
    N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,N1.Price,
    (sum(N1.inqty)-sum(n1.outqty)) as [Opening Balance],
    0 as [IN],
    0 as OUT
    From dbo.OINM N1
    Where
    N1.DocDate < @FromDate and N1.Warehouse = @Whse
    Group By
    N1.Warehouse,N1.ItemCode,N1.Dscription,N1.Price
    Union All
    select
    N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,N1.price,
    0 as [Opening Balance],
    sum(N1.inqty) as [IN],
    0 as OUT
    From dbo.OINM N1
    Where
    N1.DocDate >= @FromDate and N1.DocDate <= @ToDate and
    N1.Inqty >0
    and N1.Warehouse = @Whse
    Group By
    N1.Warehouse,N1.ItemCode,N1.Dscription,N1.price
    Union All
    select
    N1.Warehouse,
    N1.Itemcode,
    N1.Dscription,N1.price,
    0 as [Opening Balance],
    0 as [IN],
    sum(N1.outqty) as OUT
    From dbo.OINM N1
    Where
    N1.DocDate >= @FromDate and N1.DocDate <=@ToDate and
    N1.OutQty > 0
    and N1.Warehouse = @Whse
    Group By
    N1.Warehouse,N1.ItemCode,N1.Dscription,N1.price) a, dbo.OITM I1
    where
    a.ItemCode=I1.ItemCode and
    I1.ItmsGrpCod = @Group
    Group By
    a.Itemcode
    Having sum(a.[Opening Balance]) + sum(a.[IN]) + sum(a.OUT) > 0
    Order By a.Itemcode
    Regards,
    Vamsi

    Hi Gordon,
    We are maintaining different Price Lists  so is it possible to give the input in the query to select the report based on which price list???
    Or else  is it better to create an udf in item master data for Standard price of the item and display it in report??
    And i have another doutb that while i run the inventory audit report  and the query it is showing different values .. why is it so??
    pls give me the solution for the same,
    thanks in advance..

  • Report for Activity hours consumed

    Dear All,
    I am lookinf for a report showing no. of  activity hrs. actually consumed with in a given period.I guess there are certain reports available in CO ,but looking for the right one.Plz help.

    here are the reports
    1.S_ALR_87013611- give cost centre where the activity is consumed
    2.KSB1 - give cost centre where the activity is consumed
    3.S_ALR_87013646 - give activty type and period

  • Time report for every process the VI made

    how can I know the most time consumig part of my VI 
    in other words can i make somthing let me know how long every part in my VI took ? 
    thanks
    Solved!
    Go to Solution.

    hii GrerdW
    I thik this will help me alot
    thaanks alot

  • How create  dynamic URL for every row  shown in the report?

    Hi,
    Iam new to this Application. I created one interactive report to find the number of bugs logged for every product and its sub component for past one year. The report will look like below structure in the application.
    Product Subcomponent Total
    P1 S1 10
    P2 S2 4
    P2 S21 15
    Now i want to pick the value of Prouct and sub component for every row dynamiaclly and want to generate the URL with the conditions and make it as hyperlink for the Total Column.
    Iam able to make hyperlink for the Total column using the edit options for the total attribute, but it is opening the same page for all the rows in the total column. I want to generate dynamic URL by picking the value prodcut and sub componenet dynamically from the report for every row and want to make it as hayperlink for every row individually.
    Please tell me how to do this?
    Please revert back if you are not clear. Appericiate for your quick help.

    Hello <unknown user>,
    So you already set the Column Link attributes for your Total column. Should all links go to the same page, but with different parameters (ProductID, SubcompID)? Or to another page? And how can you determine that page?
    Assuming you'll go to a sort of detail page or form:
    Target = [Page in this app]
    Page = <your target page no>
    Item1 = <ProductID field in target page>
    Value = #PRODUCTID#
    Item2 = <SubcompID field in target page>
    Value = #SUNCOMPID#
    (you can use the ' flashlight' for getting the correct values)
    Greetings,
    Roel
    http://roelhartman.blogspot.com/
    You can reward this reply by marking it as either Helpful or Correct ;-)

  • Drop in associated/authenticated clients every hour

    Hi all.
    Anyone have any suggestions as to what might be causing this:
    It seems that the drops in clients occur every hour. And yes... we've got reports of unstable wireless connections, but no one reports drops every hour.
    So my question is: are there any jobs on the wireless controllers or APs that execute every hour doing some kind of cleanup? This is not related to software version on the wireless controllers. Because we see the same graph on both WiSM and CT5760.

    Hi again.
    I don't think that PI is the source of the problem here. But I will look into it.
    The reason why I don't think that PI is doing this, is that I did a SSH session to a WLC and issued a "show client summary" every minute for about 10-15 minutes. And during the time period that PI illustrates this drop in clients, I actually see a similar drop in the number of clients on the controller.
    So the question then is; what can cause this and why is the drop occurring on all of our 22 WLCs at the same time?

  • How can I make the iPhone beep every hour ?

    How can I make the iPhone beep every hour ?
    Just a beep not an alarm (alarms require an acknowledgement)

    I wanted this function as well and I just downloaded "BBClendar Free" and it works perfectly for this, better than an inexpensive digital watch!
    Just go to the Advanced section, enable the hourly beep and even set which hours (mine is 8 AM - 10 PM) and what minute of each hour it beeps on. Just be sure to leave the program open when you go on standby or it won't beep.
    As the App's description says, "Hourly Beep helps you to take a moment to rest in a busy day for every hour."
    Enjoy!

  • NUmber of Patients in an A&E department every hour

    Hi SQL Guru's,
    I've got what for me is a tricky little problem. I want to be able to count the number of patients in our A&E department at every hour of every day.
    I have access to the A&E Attendances tables that list the PatientID, ArrivalDateTime, DepartureDateTime etc so what I want to do is for example, look at how many people were in the department at 13:00hrs yesterday. This will be any patient that has arrived
    before 13:00hrs and as yet does not have a departure date time. I want this to loop and do this calulation for every hour and every day between what ever start and end date parameters I pass into the query
    Any help on this would be greatly appreciated
    Many Thanks Guys
    AntBai

    Please try this: 
    declare @current_date datetime = '2014-11-04 04:10'
    declare @last13hrs datetime = @current_date - '13:00' --select @last13hrs
    declare @Attendances table
    ( PatientID int, ArrivalDateTime datetime, DepartureDateTime datetime);
    insert @Attendances
    values
    ( 1, '2014-11-03 10:00', '2014-11-04 01:00'),
    ( 2, '2014-11-03 11:00', null),
    ( 3, '2014-11-03 18:00', '2014-11-04 03:00'),
    ( 4, '2014-11-03 23:10', '2014-11-04 04:00'),
    ( 5, '2014-11-03 23:10', null),
    ( 6, '2014-11-03 23:20', Null);
    --This will be any patient that has arrived before 13:00hrs and as yet does not have a departure date time.
    select
    count(*) over() as cnt
    from
    @Attendances
    where
    ArrivalDateTime >= @last13hrs
    and DepartureDateTime is null;
    --more data to show
    select
    datediff(hh, ArrivalDateTime, DepartureDateTime ),
    datediff(hh, ArrivalDateTime, @current_date )
    from @Attendances;
    T-SQL Articles
    T-SQL e-book by TechNet Wiki Community
    T-SQL blog

  • Running automator on the hour every hour

    I am trying to set up an image action to run every hour on the hour with out having to make an iCal entry for every hour. Also I unfortunately can't make the folder a hot folder beacuse it is a windows server.
    Is it possible the some one out their could help me with an apple script? The imaging script for automator is already made. I just would like a script to tell automator to run every hour.
    Thanks

    Try using this application to set up a cron task for that action; to do this, set the min field to 0 and put a * in the other fields which determine when the task runs.
    (18050)

  • Calculating DIrect and indirect reports for managers

    Hi,
    I have a flattened manager hierarchy. I want to calculate the direct and indirect reports for every manager. how can i do this.
    Thanks
    Edited by: user599926 on Apr 18, 2010 4:01 PM

    I've never worked with Access as a database, before.  But, if this were SQL (and it might work), then, yes, a LEFT OUTER JOIN would do the trick.
    SELECT ta.Lastname, ta.Firstname, ta.EmpID, ta.MgrEmpID, ta.Email, ta.Location
    FROM TableA ta LEFT OUTER JOIN TableA tb ON tb.MgrEmpID = ta.EmpID
    ORDER BY ta.Lastname, ta.Firstname, tb.Lastname, tb.FIrstname
    Or something like that.
    ^_^

Maybe you are looking for