Sales (and other) by Hour

I am creating a report that categorizes certain sales data by hour. For example:
Time Customers
Items Sales
8:00 - 9:00 54
413 $954.52 
So far I am just using a CASE statement such as:
SUM(CASE WHEN SE.TIME_STAMP BETWEEN DATEADD(HH, 0, @START_DATE) AND DATEADD(HH, 8, @START_DATE) THEN SE.ITEM_PRICE ELSE 0 END) AS 'PRE8 SALES',
I repeat this for each time slot.
I have two questions, if possible. Question #1: Is there an easier way to get this data from the
SalesEntries table? I figure I'd ask the experts to see if there was a more ingenious way of getting this data by hour.
Question #2: I have a unique column, se.salesID. How can I get a unique count of all the salesID values?
Thank you (as always) for any help you can provide.
Patrick
Patrick Regis

1. I would setup an hour lookup table and JOIN it in for the summary query
2. SELECT count(*) from YourTable
Kalman Toth Database & OLAP Architect
SELECT Video Tutorials 4 Hours
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

Similar Messages

  • I am not able to get in sales order and delivery  24 hours

    Hi Frinds,
    i am not able to get in sales order and delivery  24 hours even i have defined pick pack time wrkdays 24hrs in
    CONFIG PATH:-Implementation Guide for R/3 Customizing (IMG) -> Logistics ->Execution->basic shipping Functions-> scheduling-> Delivery Scheduling and transporting Scheduling -> Define Scheduling by Shipping Point Or Transaction code:-OVLZ.
    Expected  Results:-Create sales order and delivery and check that the delivery The order has 24 hours after the transfer order is confirmed to allow time to pack order
    *can you help any body  to get in sales order and delivery  24 hours .
    Regards
    Madhu

    Dear Madhu
    Apart from OVLZ, you can also check in VOV8 where for your sale document type, check whether any value is maintained in the field "Lead time in days" at the bottom screen.
    thanks
    G. Lakshmipathi

  • My iPhone 4 appears with no service every day, i have to restarted and a few hours later again the same problem, Any other solution please???

    my iPhone 4 appears with no service every day, i have to make restart and a few hours later again the same problem, Any other solution please???

    This is almost always a symptom of a phone that was jailbroken or hacked to unlock it.
    Where did you get the phone?

  • Which conversion tools used in Sales, Shipment, Invoce, and other.....

    Guys,
    I know in general that best conversion tool for Customer Master is LSMW. What about the rest of the data to be converted to SAP such as Material Master, Sales, Shipment, Invoice and other historical data? Which tools do we use for these? Do we use LSMW again?
    Thank you.

    HI,
    Yes LSMW can be used and you can also use CATTS to migrate data from Legacy system to SAP.
    Regards
    Milan
    <b>Please reward with Points</b>

  • My Ipad 2 has tried to shot down now for 3 hours, just before I could not open Itunes and App Store but Email and other apps was working. them I tried to shot down but I have now for 3 hours black screen whit turning wheel. any I deas what too do?

    My Ipad 2 has tried to shot down now for 3 hours, just before I could not open Itunes and App Store but Email and other apps was working. them I tried to shot down but I have now for now for more that 3 hours black screen whit turning wheel. any I deas what too do

    See Here for
    iPad Basic Troubleshooting
    http://support.apple.com/kb/TS3274
    Unresponsive iPad
    http://support.apple.com/kb/TS3281

  • Tried to install Lion. MacBook is running with showing Apples and other signs (questionmarks etc.) without getting finished after hours. What to do?

    Tried to install Lion. MacBook is running with showing Apples and other signs (questionmarks etc.) without getting finished after hours. What to do?

    The download took hours. But it was completed. After that i got a message that the hard-drive should not be ok. But it started updating the operating system.
    Yesterday I now installed Snow Leopard again and started the download of Lion again. Worked faster and is installed now. Now i have a problem with the charger or the battery.

  • Taking long time filling the setup tables for sales and shipment

    Hi ,
    I am trying to fill the setup tables for sales and shipment and it is taking lot of time .
    It took 16 hours just to bring 6 months of  sales history  data in the test environment .
    Cn anybody help on this issue why it is taking that much of time ...
    I am trying to  load the sales data from R/3 into APO-BW from 2005 to 2007 .......
    It is taking 16 hours to fill the data for only 6 months .

    Hi,
    1. delete data and refill the setuptables again by spliting to several small pieces.
    2. compare the data. wht is the last Document numner in RSA3(Maximum one). Start from Maximum one. may be bit complex approch.
    you need to check with PSA and base tables.
    keep one thing in your mind you need to check againest MSEG and BSEG only. noy BKPF and MKPF.
    correct if i'm wrong.
    either refill or create a user exit to avoid duplicae records(you should have very good understanding of data, it will lead to inconsitent data for delta records).
    User exit not a good solution. it's one possibility.
    ****Assign Points If Helpful****
    Regards,
    Ravikanth

  • Error while posting to Tax Journal Entry for sales and use tax

    Hi,
    I am trying to post a journal entry (FB50) to cleanup and correct the liability on our sales and use tax. All  lines are giving warnings and messages.Give me a suggestion  on how to get it to post .  Or if needed, another solution to correcting the balances in the sales and use taxes.
    But the entry to a/c # 226530 is giving an information message but still wouldnu2019t save.
    The Error message is
    Enter the tax base amounts for account 226400 in company codeAFCO
    Message no. F5A375
    Diagnosis
    You are posting directly to a tax account. Enter the tax base amounts per item using the function "Tax Amounts".
    Kindly help me how to fix the above issue.
    Thanks
    Suvarna

    You may want to check out the following notes... they may shed some light on your problem.
    681930 - Posting on tax account possible w/o specific. of base amount
    1090096 - FB60 / MIRO - Checking direct tax after change (F5A375)
    944978 - FB60 / MIRO - check of direct tax after change

  • Free Goods Regarding u0096 Sales and Distribution

    <b><u>Scenario</u> :</b>
    I. To represent free goods explicitly in Billing & Delivery & to represent the same in the Invoices & Transport & Shipping.
    II. To make account for the free goods in the accounting and Material documents.
    a. Here the free goods may belong to free goods item category.
                 (or)
    b. The same material may be given as a extra free item for n Quantity Sale of a material.
                 (or)
    c. There may be any Free Goods for certain amount of Purchase.
    How can we identify items as free goods or there are any compliments for a sale and how do we account for it?

    Hi Peterson
    You can identify the free goods by the item category.
    For Accounting purpose in Material documents, create a new schedule line category and a new Movement type.
    Assign the G/L accounts to the new Movement type.
    Assign the movement type to the Schdule line category and then assign the schedule line category to the item category.this will take care of accounting in Material documents.
    If you want different G/L account postings at the time of invoice creation then perform the account determination using the item category.
    Please award points if this helps
    Thanks

  • No 'Sales and Distribution-data' in COMMPR01

    Hi All,
    I've download products from R/3 to CRM and eveything worked out fine, except the following: I don't see any 'tuples' assigned in the 'Sales and Distribution-tab' in COMMPR01. There is also no possibility to assign a tuple in this tab, because the button for 'assigning' is greyed out and I don't want to assign a tuple for every product manually.
    Before downloading the products, I've created a org. chart which seems to be fine. In this org chart you can see the correct sales organization and distribution channel. Besides that: 'Obj. Permitted in Determination' is checked.               
    Can somebody help me with this issue? So how do I incorporate a tuple in the 'Sales and Distribution-tab'?
    Kind regards,
    Maarten.

    Hi Maarten,
    Please check the following:
    - The value for attribute Tuple(distribution channel,division) in Attributes tab of scenario SALES is not maintained for transaction PPOMA_CRM (Maintain Organizational Model)
    Also, the problem might be the buffer is not getting updated.
    Please check the following steps in your system.
    1.Check flag 'Obj. Permitted in Determination' checked on the attribute
    tab in TA PPOMA_CRM for the organization Unit in question
    2.Check the buffering for SALES/SERVICE is switched ON in table T77OMATTR
    3.Report HRBCI_ATTRIBUTES_BUFFER_UPDATE be executed on a
    regular basis -> Please see documentation of this report
    I hope, this helps you.
    regards
    Srikantan

  • ER Contribution should not Deduct from EE SAL and not Display in Payslip.

    Hi Experts,
    I  have Pension ER contribution Wage type:
    1. That should not deduct from Employee SAL
    2. Should not display in Payslip.
    3. Amount store in RT.
    What changes i should do in V_T512W_D table
    Appreciate your early response.
    Regards
    Raj

    Hi,
    We are maintaining the EE & ER contribution.
    EE is working fine with all the validation & deducting from employee every month.
    When we are handling ER contribution that amount is getting deducted from EE sal.
    So we want to restrict ER contribution Deducting from employee sal and not to display in Payslip.
    Figuring out how can we handle this thru Processing, Cumulating or Evaluation class.
    Kindly advise
    Regards
    Raj

  • I am trying to restore my phone but everyone I go to do it, it goes to Update which takes 2 and a half hours, and everytime it fails. Ive tried four times now. I'm trying to restore because it says my memory is full, when it is not. I'm so frustrated.

    I am trying to restore my phone, but when i go to do it on iTunes, it Updates to 4.3.3 however everytime the 2 and a half hour update finishes, it FAILS. So the update fails, and the restore fails. Its happened 4 ties.
    Im trying to restore my phone, because it says my memory is full when its not and an online solution says to restore. I cant restore because it wont let me update.
    Im so frustrated, i cant take any pictures, download any music or apps, and its really getting me down. Please can someone help.

    This error generally indicates a hardware failure.  Bring the phone to Apple for evaluation.

  • Hanging start up and other oddities

    Hanging Startup and other oddities
    I'm not especially proficient with the upkeep and terminology that comes with the programming aspect of Macs, so, if you do help, if you could please put whatever advice you have in lay terms, it would really help me out.
    I've had my laptop computer for going on three years now, and I've never had a problem like this before. My machine started to really slow down yesterday morning, and generally when ever it does that, I just do a quick restart, and everything is back at normal. Well, not so yesterday.
    To begin with, it took me to the grey screen, and it just stayed there for about ten minuets. It didn't change, didn't move to load the apple insignia, nothing. So I gave it a forced restart, and it did it again, except it load the apple logo.
    Third time, it got me to blue screen. On restart #4 (force restart #3), it finally loads into my desk top, but the slow processing remained. I tried to go in and repair disk permissions, but then it froze up, and I forced a restart. This time, back to the grey screen.
    I lost count as to how many time I restarted, but I finally went and rooted out my OS disks, and did a restart with disk 1 in, holding down PR+CtrlApple (It was my understanding that this would zap the P-Ram, and would at lest sort of help with whatever my problem was). Well, it took me to grey screen, but now a small folder is in the center of my screen. going from the finder icon to a "?" in the middle of the folder.
    Did a restart holding down the "C" key, and it went into the install screen that launches from the disk. I was able to click through to select the drive I wanted, then my hard drive didn't show up as a possible selection. Yet ANOTHER C key restart, and this time it showed up.
    Went through the first loading screen, where it is checking permissions, and everything's fine, but when I get to the installation process, it tells me there is an error with my perimeters, and I should restart and try again. Did this again, and I had to start over from square one.
    I tried just a normal restart after three or four attempts at an installation, and now, whenever I load it without C depressed, a grey box shows up in the middle of my screen with an image of the globe on it, and it flashes. Nothing else loads until I do a restart.
    It's my impression this, obviously, isn't a good sign and I should get in contact with someone who knows what they're doing and can walk me through it and get my computer running again. I thought I'd run it by you guys here before I called Apple, and, hopefully, you guys can help me out/help me better describe my problem. Any help you can give - links to other threads, experiences, what something means, what to tell a technician that I'm looking at/going through, anything at all, will help me tremendously.
    Thanks for your help and time,
    Brittany
    Powerbook G4   Mac OS X (10.3.9)   Owned Since April, 2004

    Hey Gary, thanks for the welcome!
    By the time I was able to pull your suggestions off of the form, I had already done a few things to my computer, as per recommended by the Apple site. This article is what I was pulling my steps off of.
    I started at step 4 (Selecting the "Connect automatically when starting TCP/IP applications") and went through to step 8, semi-step i.
    1 - I tried to start up in safe mode (Shift+Restart) and I logged several kernal panic screens before I even got to the apple insignia on a grey screen.
    2 - I ran Disk Utility several times, and would come up with an error and a notice that the utility had quit. The first time I ran it, I noticed that it had found a lot of Oprhaned indirect iNodes, and by the second time the utility was ran, they no longer showed up in the right pane of the box. The fifth time it ran, it took roughly two hours to complete, and actually went all the way through.
    3 - Still would not load past the grey screen, so I went through and did fsck check a couple of times, and it told me that my machine appeared to be ok. I got all the way through the step where it tells you to run a fsck, then type in a mv Preferences Preferences_old, then did a reboot and let my computer load.
    When it finally did load (the actual boot up and load took about ten minuets, which is about seven minuets slower than normal), it took forever to do any commands that I issued. I went through and backed up all of my files onto my external, and then I went to go follow the rest of the step, and my computer froze up. I decided to save the rest of the procedure for today, when I can find some time.
    The basic thing that I'm concerned about now is that the machine is running exceptionally slow. It loaded Safari and a couple of other applications I'm always in, but it took roughly ten times longer than normal to do anything.
    Since it's recignising the machine and loading into my desktop, I was going to see if I can now do a safe restart and see if I can follow any of the steps that are dictated by the site, but I'm still not certian if that will work. Last time I tried it, I got a kernal panic screen.
    Anything I should try?
    Powerbook G4   Mac OS X (10.3.9)   Since 2004

  • Just bought an iPhone 5s, as I turned on the phone it showed 71% of battery, I drained it to 15% and next charged it for 3 and a half hours to fully charged. Did I do any mistake ? Should have I let it to get discharged in order to fully charge it ?

    Just bought an iPhone 5s, as I turned on the phone it showed 71% of battery, I drained it to 15% and next charged it for 3 and a half hours to fully charge. Did I do any mistake ? Should have I let it to get discharged in order to fully charge it ? Somebody told me I should have let it discharged and then to fully charge, but I didn't do it, my iphone is working very well, the battery too but I'm worried if the battery lifespan is gonna get worsen soon if I didn't abide by the rules and procedures of battery charging.
    I had problems on my previous iPhone 4s, it died because I didn't replaced the battery with a new one because my battery never worked well and I never knew it , the battery used to overheat my iPhone and it caused to damage my processor completely to death. Who does the replacement of the iphone processor?  I need help how to maintain with the iphone battery. And also let me know if I did something wrong that I should get worried about or not ?!?!

    Apple does not fix the iPhone 4S, they replace the phone. If not covered by warranty, called an out of warranty exchange. Cost is US $199. Make an appointment at any Apple store.
    Be aware, Apple does not sell iPhone parts, thus there is no legitimate source for genuine parts.

  • I've tried downloading iOS5 several times and after an hour each time I get a message that says my network connection has timed out.  But I can't find any information about "timing out" or how to correct the situation.  Any help?

    I've tried downloading iOS5 several times and after an hour each time I get a message that says my network connection has timed out.  But I can't find any information about "timing out" or how to correct the situation.  Any help?

    Disable your antivirus and firewall, and try again.

Maybe you are looking for