Total open tasks count by week

Hello,
I was wondering if someone is able and willing to help me with a code to calculate something in MS SQL server (me being at the start of learning SQL myself).
I apologize in advance if this is not the section I should post on, or the type of question you people care about :)
I have a table that among other information, it would contain:
TaskID
DateCreated (the date each task was created)
Date Closed (the date each task was closed, if closed yet)
Week_Of (this is also a date format and it represents the fiscal week that the 'DateCreated' is part of; for example Week_Of 30-Nov-2014 is linked to 30-Nov-2014 to 06-Dec-2014 dates).
I want to show the number of tasks that are still open at the end of each 'Week_Of'. So for 'Week_Of' valued 30-nov-2014, I need a count of all tasks submitted by 06-Dec-2014 (Week_Of+6) that were either not closed at this date (DateClosed NULL) or were
closed on a more recent date.
This calculation to be done for each value of 'Week_Of' in the table (so, across several fiscal years).
Each week new tasks are created (that would also have to be counted on the next 'Week_Of' calculation) and some of the existent tasks are closed (which of course, should not be counted anymore for the next 'Week_Of' calculation).
Thanks.

DO you mean this?
SELECT ProjectID,ProjectType,WeekOf,COALESCE(Cnt,0) AS OpenTasks
FROM
SELECT DISTINCT ProjectID,ProjectType,WeekOf,DATEADD(dd,(DATEDIFF(dd,0,DateCreated)/7) * 7,5) AS EndDate
FROM Table
)t
OUTER APPLY(SELECT COUNT(*) AS Cnt
FROM Table
WHERE ProjectID = t.ProjectID
AND ProjectType = t.ProjectType
AND CASE WHEN DateCreated > EndDate OR DateClosed < EndDate - 6 THEN 0 ELSE 1 END = 1
)u
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page

Similar Messages

  • My pdf reezes when I click on COMMENT. I am trying to get at the tools to edit a pdf. If I use the tools from the toolbar, there is no issue, but once I click COMMENT, the document freezes and I have to open Task Manager to crash it. This started in the l

    Sorry, I am new to the type of problem-solution process and I do not know how to edit my first statement. My true statement is below:
    My pdf freezes when I click on COMMENT. I am trying to get at the tools to edit a pdf. If I use the tools from the toolbar, there is no issue, but once I click COMMENT, the document freezes and I have to open Task Manager to crash it. This started in the last seven days (3.31.15).

    I answered your questions below, BUT while I was searching for properties, I found the REPAIR ACROBAT INSTALLATION feature, did the repair and (Voila!) the issue was resolved!
    Thanks for making me search for information.
    Karen
    I am using Acrobat XI Pro, version 11.0.10.32.
    I did not create the file I was working in during the freezes, so I tried a PDF that I created with Adobe and it also freezes when I click on COMMENT. I did discover that the COMMENTS plug-in is loaded. (see image
    I have used COMMENT for years without this issue occurring. It started in the last 2 weeks.
    I could not find Properties under the file menu, but found a security setting in Preferences under the Edit menu. It did not have a way to allow/disallow COMMENT.

  • Count of Weeks where a certain measure is 0

    Hi,
    I'm trying to create a calculated measure which would give me count of weeks where a certain measure say Sales is greater than 0. I have a hierarchy YEAR->QUARTER->MONTH->WEEK in time dimension DIMTIME. And I have used the expression COUNT(MYCUBE_ONHANDASSETS GT 0) to get the count. But this expression gets count of weeks from all the years instead of selected time periods. Lets say I have the measure MYCUBE_SALES greater than 0 at 2 weeks in Jan 2010, then the count should be 2 at level Jan 2010 in the hierarchy. But it shows 50 which is total weeks in year 2010 where MYCUBE_SALES is greater than 0.
    Can anyone help me solving the issue ?
    Thanks,
    RK

    You should be able to copy the data from your MYDWCUBE_AVG cube to COUNT_CUBE using OLAP DML.
    First limit the dimensions to the appropriate leaf values, then assign. The ACROSS clause should list the partition template (if MYDWCUBE_AVG is partitioned) or the composite if it is not. I am approximating below.
    LIMIT TIME TO TIME_LEVELREL 'MONTH'
    LIMIT PRODUCT TO PRODUCT_LEVELREL 'SKU'
    ...other leaf level conditions
    LIMIT COUNT_CUBE_MEASURE_DIM TO 'ONHANDASSETSCOUNT'
    LIMIT MYDWCUBE_AVG_MEASURE_DIM TO 'ONHANDASSETS'
    COUNT_CUBE_STORED = MYDWCUBE_AVG_STORED ACROSS MYDWCUBE_AVG_PRT_TEMPLATEIf you are in 11.2.0.2 then you can also use DBMS_CUBE to copy the data without needing to worry about the physical object details.
    begin DBMS_CUBE.BUILD(q'! COUNT_CUBE USING
         FOR
            "TIME" LEVELS ("TIME"."MONTH"),
            "PRODUCT" LEVELS ("PRODUCT"."SKU"),
             ... other leaf level conditions ...
         BUILD
           SET COUNT_CUBE.OnHandAssetsCount = MYDWCUBE_AVG.OnHandAssets
    end;
    /

  • Closing an open task programatically

    HI,
    I have created a custom component in order to establish connection to BPM .
    The flow is such that , the connection gets established and i need to fetch the tasks based on the workflowInstance and user ID specified.
    I am able to fetch the tasks from which i extract the task state.
    Need to close the state of an open task i.e need to update the state of the task to close. Not able to do it.
    How do i achieve this?
    This is the piece of code that is supposed to perform the functionality.
    Please have a look and provide your inputs in order to achieve the needed.
    Function Call:
    this.updateTaskOutCome(task1, "CLOSE");
    Function Defnition:
    public int updateTaskOutCome(final task,
                                     final String outcome) {
            // variable to show success or failure
            int success = 0;
            // creating reference for TaskQueryService
            TaskQueryService taskQueryService = null;
            // creating reference for WorkflowContextType for admin context
            WorkflowContextType adminContext = null;
            // creating reference for WorkflowContextType for user context
            WorkflowContextType userContext = null;
            TaskService taskService = null;
            oracle.bpel.services.workflow.task.model.Task outcomeUpdatedTask =
                null;
            CredentialType adminCredentialtype = this.createAdminCredentialType();
            CredentialOnBehalfOfRequestType onBehalfRequestType =
                queryFactory.createCredentialOnBehalfOfRequestType();
            // calling getService method og BPMConnection
            //get taskQueryService Object from BPMConnection
            //taskService = getService("taskAction");
            //creating WorkflowContext for admin
            //setting admin context to onBehalfRequestType
            try {
                taskQueryService = (TaskQueryService)getService("taskQuery");
                adminContext = taskQueryService.authenticate(adminCredentialtype);
                onBehalfRequestType.setOnBehalfOfUser("username");// admin username given
                onBehalfRequestType.setWorkflowContext(adminContext);
                //creating WorkflowContext for user
               userContext= taskQueryService.authenticateOnBehalfOf(onBehalfRequestType);
                // getting BPM Client for performing user actions
                taskService = (TaskService)getService("taskAction");
                // creating UpdateTaskOutcomeType object and setting its property
                UpdateTaskOutcomeType updateTaskOutcomeType =
                    taskActionFactory.createUpdateTaskOutcomeType();
    //            //setting outcome
                updateTaskOutcomeType.setOutcome(outcome);
                //setting task
                updateTaskOutcomeType.setTask(task);
                // setting userContext
               updateTaskOutcomeType.setWorkflowContext(userContext);
                // calling webservice operation for performing user action
                //setting success variable
                outcomeUpdatedTask =
                        taskService.updateTaskOutcome(updateTaskOutcomeType);
            } catch (StaleObjectFaultMessage e) {
                Report.trace("mysectionstring",
                             "inside staleobject fault message catch block", null);
    //        } catch (WorkflowErrorMessage e) {
    //            TaskQueryServiceFaultType faultInfo = e.getFaultInfo();
            } catch (Exception e) {
                e.printStackTrace();
            if (outcomeUpdatedTask != null) {
                success = 1;
            return success;
    Thanks in advance,
    Bharath

    Any one facing similiar issue?
    Could someone please provide some information.
    Thanks,
    Bharath

  • Vendor Total open balances report

    Hi,
       Iam working in client location sbi mumbai.My client is having 2,95,000 employees/vendors total.Every month they contribute
    G/L(10000000) member contribution for PF
    G/L(10001000) bank contribution for PF
    Means every month two invoices will e posting for each employee/vendor. We can see the reports in T code :(FBLIN)/(FK10N),(FS10N).
             But my client is asking report like total vendor/employee balance at year end,member contribution at year end,bank contribution at year end. in one screen for 2,95,000 employees indiviadully.
    Vendor Total open items balances report not from T Code:(fbl1n),(fk10n),report or Bsik table.Because this all showing all line itemwise. But i want only total balance of all vendors/employees individually at year end.
    Thanks & Regards
    Rajeswari .ch

         Total vendor Balances as on 31.03.2014
    vendor no
    Total vendor balance
    Member contribution
    Bank contribution
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    till 2,95,000 employee
         Total vendor Balances = Members contribution + Bank contribution - Advances - Withdrawals
    ex:
    Members Contribution
    per month =1000
    Year end
    per anum =12000
    I want to see year end balance for all 2,95,000 employees individually
    G/l balances report also i want.

  • Total open purchase order quantity fro a material

    Hi,
    Waht is the table that contain the total open purchase order quantity (on order quantity, not yet goods receipt) for a material number?

    hi,
    You can check the table EKPO, EKKO, and EKBE...
    also for delivery schedules use the table EKET...
    You also have a report ME2N for the same, use the proper selection parameter...
    regards
    Priyanka.P

  • When closing my Firefox window, all processes are not closing requiring me to open task manager and kill the process before using Firefox again. Received recent upgrade and hasn't worked right since then.

    I open Firefox, use it, then close the window. Try to reopen Firefox and it fails with a message that a previous process is still running. Requires me to open Task Manager and kill the old process.

    Try to wait a bit longer before reopening Firefox to give Firefox more time to close completely.<br />
    Try to use "Firefox/File > Exit" (Mac: "Firefox > Quit"; Linux: "File > Quit") to close Firefox if you are currently doing that by clicking the close X on the title bar.
    See "Hang at exit":
    *http://kb.mozillazine.org/Firefox_hangs
    *https://support.mozilla.com/kb/Firefox+hangs

  • Open Task Button does not come in Outlook

    I have a three level approval workflow in which each level an email is generated to the approve to approve or reject.
    But suddenly the Open Task Button does not pop up in Outlook 2010 anymore can you tell me why?
    Srinivasan Kidambi

    had the same issue with External users not using Outlook. This is how I fixed it:
    Open the task list that the workflow is using and connect it to Outlook. Then kick off a workflow to make a new task. Once the task is made open the task from Outlook. The bottom options (review, perform the specific req. for the task, and Open this task)
    are now links. Hover your mouse over the link and you will see the address.
    Now open SPD, connect to your site and open the work flow assc. to the doc lib.
    Start editing the workflow and click the "Approval" link
    Click "Change the behavior of a single task"
    You are going to have to look for all the instances of "then e-mail task notification to "Current Task:Assigned to"
    Open "Current Task:Assigned to"
    Click where you want he link to go and hit the Hyperlink button
    name the link whatever you want, then hit the string builder ("..." button)
    Copy the link from the Task in Outlook into the string builder (if you use External addressing you can also hard code the External address).
    At the very end of the link where is says ID=(then a number) delete the number and DO NOT put a space. Click the Add or Change Lookup button and use "Current Task: Approval" "ID" "As String" and click ok. Should like this:
    Now this will not pop the form up, but it will send the user straight to the task form (might have to enter username and password) for the correct task. Remember to do this to all the "Current Task:Assigned to" in the workflow. It sounds like a chuck of
    work but it does not really take thaty long on the OOTB Approval workflow.
    Just wanted wanted to add my two cents.
    Also check
    http://social.technet.microsoft.com/Forums/en-US/417466a3-cdcb-4559-8453-9fff6da4aceb/getting-around-a-missing-open-this-task-button-in-a-nonoutlook-email?forum=sharepointcustomizationprevious
    If this helped you resolve your issue, please mark it Answered

  • What constitutes an "open' task?

    How does the system decide which tasks to put in this list? Is it based on status, created date? A combination of fields?
    Any help would be appreciated!
    B

    I thought that was the case, but when I look at the open tasks on the homepage, it only seems to have ones for the current month. Is this correct?

  • Help me in  'AR Details ' report shows total open invoices by customer

    hi friends,
    please  help me in  'AR Details ' report shows total open invoices by customer and PO number over selected time range.
    any thing related to open invoices please send me as early as possible.
    Thanks,
    Regards,
    Yogesh

    Hi,
    Find the T.code VF05. You will get the list of open billing docs. Its SIS report. Please find whether the SIS is active or not in your system
    Regards,

  • Filtering My Open Task in SAP CRM based on Status, Transaction & Partner Function

    Hello
    Whenever i create a Task in SAP CRM, it displays that transaction in the My Open Task of all Business Partners involved in that Transaction.
    I want to restrict the My Open Tasks based on Transaction Type, Status and Partner Function.
    1) The system should work as it is for all other Tasks but for my Custom Transaction Type the logic should be based on status of the Transaction
    2) When My Open Task component is prepared the system should consider the Status and Partner Function as well i.e. if the status is Approval of Manager, the system should show the Open Task only to the Manager and not other parties.
    3) if the status of the Transaction is Open, the system should only display this Transaction / Task only to Employee Responsible and not to Manager and other people involved in their My Open Tasks.
    I have gone through the following post in SCN:
    https://scn.sap.com/thread/2056959
    I have implemented the method DO_PREPARE_OUTPUT as per the post but it does not do anything. When i redefine the method GET_QUERY_RESULT and remove everything,it does not prepare any list.
    If possible please specify which method needs to be redefined in the component/view CRMCMP_GS_WC/TodaysTasks & if possible please share the code that needs to be maintained in that method.
    Thanks

    Hi,
    Method DO_INIT_CONTEXT should be redefined
    This should be redifined to get the collections with your required filter criteria.
    * get the collection of entities for the tasks
       lr_col      = get_query_result( gc_status-open ).
    If this does not help, Delete the collections which are not required after above selection but before this code.
       me->typed_context->resultnew->collection_wrapper->set_collection( lr_col ).
    Thanks
    Ajay Singh

  • How to send a work item ( Mail ) as open tasks in WEB UI

    Hi,
      I have a requirement as to send a WF work item of mail text to WEB UI as open tasks.  Upon click of te link; the mail txts comes there with the link detials to the service contract number and service contract quotation. Upon click of the links it need to redirect to the respective documents.
    The requirement is as such that 60 days prior to the contract end date we need to trigger a mail that 'the contract expires in 60 days,do you  need to renewal it'. This text need to go to the WEB UI respective agent of this mail as tasks. Upon click of the task description link need to navigate to the mail text with the details of the contract and quotation numbers in link. upon click of the lnk it needs to navigate such that they can change accordingly and the contractrenewal process is completed.
    How to acheive this one.
    Thanks and Regards,
    Satish Akkina

    Hi,
    Sending Mail to Outlook : U need the Following things done for this:-
    1> Use the Mail Step in the WF and Choose the Receipient as the E-Mail Address and Give the E-Mail Address there.
    2> Check the Configurations that need to be done in Transaction SCOT. SMTP Server Settings are done to get the Desired Results.
    From the external mail, they should have the flexibility to approve or reject PO.
    To get Workitems in Outlook..!!
    https://www.sdn.sap.com/irj/scn/wiki?path=/display/abap/workflow%252bscenario
    Problem in transferring the workitems into OUTLOOK
    /people/saujanya.gn/blog/2006/12/19/how-to-get-work-items-your-outlook-inbox
    Workflow Items in Outlook
    Let me know if u still face any issues.
    Regards,
    Kanika

  • Indesign CS6 Total Document Word Count... No?

    I left the following comment on a Youtube tutorial explaining how to execute a word count query for an Indesign document ASSUMING your article layout uses a single box of text:
    What if an article uses a creative layout with multiple text-boxes? Are you supposed to get out your pocket calculator and add them up one-by-one?
    I work for a magazine that publishes short, submission-style testimonials bridged together with staff-generated narrative copy; some of our articles use six or more discreet text-boxes. You REALLY MEAN TO TELL ME that there is NO WAY to yield a TOTAL DOCUMENT WORD COUNT using what is SUPPOSED TO BE the MOST ADVANCED page layout application ON EARTH??
    Pardon my exasperation in the above comment, but....Seriously?  
    I need someone knowledgeable to please look me in the eyes and tell me, "This is true", before I am going to be able to let myself believe it.
    Thank you.
    - Exasperated Journalist Slag

    Yes, there are ways, just not what you expected.
    One approach to counting words in multiple text frames in InDesign is to thread them together. To maintain the pieces of text in their assigned threaded text frames, you can create a paragraph style that starts in the next frame, and assign it to the first paragraph in each text frame. Or, you can break the threads when the count is stable.
    If the text frames need to adjust their size to the amount of their content, search Google for terms like "indesign auto resize text frame" without quotes for details.
    There was a recent discussion about auto-resizing text frames that mentioned the free AutoFit InDesign plug-in, from typefi.com. Search Google for terms like "indesign typefi autofit" for details.
    Search Google for terms like "threading and unthreading InDesign text frames" without quotes, for details.
    Search Google for terms like "indesign start paragraph in next frame" without quotes, for details.
    You can file a formal feature improvement request here: Wishform.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices
    evanexempt wrote:
    I left the following comment on a Youtube tutorial explaining how to execute a word count query for an Indesign document ASSUMING your article layout uses a single box of text:
    What if an article uses a creative layout with multiple text-boxes? Are you supposed to get out your pocket calculator and add them up one-by-one?
    I work for a magazine that publishes short, submission-style testimonials bridged together with staff-generated narrative copy; some of our articles use six or more discreet text-boxes. You REALLY MEAN TO TELL ME that there is NO WAY to yield a TOTAL DOCUMENT WORD COUNT using what is SUPPOSED TO BE the MOST ADVANCED page layout application ON EARTH??
    Pardon my exasperation in the above comment, but....Seriously?  
    I need someone knowledgeable to please look me in the eyes and tell me, "This is true", before I am going to be able to let myself believe it.
    Thank you.
    - Exasperated Journalist Slag

  • I have been working on the same numbers file for the past few weeks.  The last time I opened it was 1 week ago.  Today when I tried to open it I am unable and getting a message that the file is invalid and the index.xml file is missing.

    I have been working on the same numbers file for the past few weeks.  The last time I opened it was 1 week ago.  Today when I tried to open it I am unable and getting a message that the file is invalid and the index.xml file is missing. 

    Hi Tracie,
    I upgraded to Maverick OS X 10.9.5, numbers spreadsheet is saved. Upon re-opening, it appears to be frozen, a warning "file is invalid as index.xml file is missing". I checked, and the file is not "locked". This appears to occur only with using the new numbers app. When I open previous spreadsheets from old iWorks, no such problem occurs.
    How did you resolve your problem?
    Would appreciate any help here.
    Thanks,
    Deehay

  • Form Filler Yellow Task Bar Link Does Not Open task or do anything SharePoint 2010 InfoPath 2010

    Form Filler Yellow Task Bar Link Does Not Open task or do anything (SharePoint 2010 InfoPath 2010)
    Using a SPD workflow to run a approval process. This is a non-browser form. User receives task notification, opens form in IP Form Filler and sees yellow task bar notification. User Clicks on open task, nothing happens... OS = XP, On Win7
    = We get a never ending download box, and several logon security windows
    Attempted Fixes
    Clear
    InfoPath Cache
    Workflow History Looks good

    Hi,
    I understand that when you click on Edit this task in the message bar in InfoPath 2010, nothing happens. Does this happen when you open the email which contains the ‘Edit this task’ link?
    If so, you can try to check whether this key is in your regedit. If so, you can delete this key and have a test.:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\ActiveX Compatibility\{00000000-0000-0000-0000-000000000000}
    Back up the regedit keys before making any changes. For more information about backup and restore the regedit, please refer to these sites:
    Fix “Edit this task” In Outlook 2007:
    http://vettekerry.wordpress.com/2008/06/11/edit-this-task-in-outlook-2007-doesnt-work/
    How to back up and restore the registry in Windows XP:
    http://support.microsoft.com/kb/322756?wa=wsignin1.0#method1
    Thanks,
    Entan Ming
    Entan Ming
    TechNet Community Support

Maybe you are looking for

  • Microsoft Office for Mac open recent File menu option causing AFP to crash

    Hi all, We have an Xserve running Mac OS X Server Leopard 10.5.8. The Xserve hosts three file shares for about 60 users. Our network is 99% Mac based running mostly 10.5.8 with a few 10.6.x. We have historically over the past several years had the AF

  • Tables selection for out put

    Hi All, I have some problem in line items dispaly . In my report i am selecting data from BSAS and BSIS tables using some radiobuttons. but in my specification mentioned BSID-fields ,line Items as reference fields to be dispalyed. means i am taking d

  • HT201302 How do i get my photo gallery back

    I bought the iphone 5, everything transfered except my photo gallery

  • After Update to 19.0, Crash Frequently and Plug-in Container Issues

    Ever since I updated to FF 19.0, I noticed that FF crash more often than usual, without any reason (I was in the middle of reading a website). And also the plug-in container for Adobe Flash kept consuming high cpu usage, thus slow down or even freeze

  • Trying to set maximum number of calls

    Hi, im pretty new to this topic and i would appreciate some hel... I try to set the maximum number of calls to 3. As far i understand it is done by XML script under phone service, but thats about it... where do i ha ve to change this value in databas