Group data by "week" in 3d Chart

Hi all,
I need to be able to group the results of the below query by week, so it displays better - problem is I have no idea how to do this.
At the moment it is finding all "active" projects in my database, and then displaying the count that are deploying on a given day. What I now need to do is display the total projects deploying in a given "week" over the date range (ie. Week 1 has 23, Week 2 has 13, and so on)
Can anyone advise how I would go about modifiying the query to achieve this in Apex 4.1?
select
'f?p=&APP_ID.:87:&APP_SESSION.::NO:RP:P87_DISPLAY_DATE:' || bus_deployment_launch link,
bus_deployment_launch LABEL,
sum(No_Proj) Value
from
select
  count(a.initiative_name) No_Proj
  ,a.bus_deployment_launch bus_deployment_launch
  ,a.status status
from EWCM_INITIATIVE a
where (a.STREAM_SERVE like '%Assurance%' or a.STREAM_SERVE like '%O2A%')
group by bus_deployment_launch, status
union
select
   count(name) No_Proj
  ,requested_date bus_deployment_launch
  ,status status
from ewcm_gtm_initiatives
where PORTFOLIO != '141'
and (impact_assurance = 'Y' or impact_o2a = 'Y')
group by requested_date, status
union
select
0 as No_Proj, nvl(to_date(:P85_START_DATE,'dd-mon-yyyy'), TRUNC(SYSDATE,'MONTH')) + level-1  bus_deployment_launch,'In progress' status
     from dual
     connect by level <= nvl(to_date(:P85_END_DATE,'dd-mon-yyyy'),(LAST_DAY(TRUNC(SYSDATE)))) - nvl(to_date(:P85_START_DATE,'dd-mon-yyyy'), TRUNC(SYSDATE,'MONTH'))  +1
where bus_deployment_launch between nvl(:P85_START_DATE,(LAST_DAY(ADD_MONTHS(TRUNC(SYSDATE),-1))+1)) and nvl(:P85_END_DATE,(LAST_DAY(TRUNC(SYSDATE))))
   and status in ('In progress','Non-GTM','Ideas Stage','Scope Review','Change Management','Change Mgmt','Pending','Ongoing')
group by bus_deployment_launch
order by label asc

Paul Ferris wrote:
Sorry I mean to show a count of projects in a week (so adding Monday through to Sunday together)
The simple option—providing it matches your definition of "week"—is just to wrap your existing query in another that aggregates by ISO week (the 'IW' format mask). With start date 01-JAN-2014 and end date 31-JAN-2014:
with t as (
      select
          0 no_proj
        ,   nvl(
                to_date(:p85_start_date, 'dd-mon-yyyy')
              , trunc(sysdate, 'MONTH'))
          + level - 1 bus_deployment_launch
        , 'In progress' status
      from
        dual
          connect by level <=   nvl(
                                    to_date(:p85_end_date, 'dd-mon-yyyy')
                                  , last_day(trunc(sysdate)))
                              - nvl(to_date(:p85_start_date, 'dd-mon-yyyy'), trunc(sysdate, 'MONTH')) + 1)
select
    to_char(trunc(bus_deployment_launch, 'iw'), 'DY DD.MM.YYYY') week
  , row_number()
      over (
        order by trunc(bus_deployment_launch, 'iw')) week#
  , status
  , count(*) n
from
    t
group by
    status
  , trunc(bus_deployment_launch, 'iw')
WEEK                         WEEK# STATUS               N
MON 30.12.2013                   1 In progress          5
MON 06.01.2014                   2 In progress          7
MON 13.01.2014                   3 In progress          7
MON 20.01.2014                   4 In progress          7
MON 27.01.2014                   5 In progress          5
You should be able to remove the aggregation at day level from the inner queries.

Similar Messages

  • Group data by week of data filter in ssrs

    Hii all
    I am creating matrix report  where report has date parameters like @From_Date and @To_Date
    and more, i want to provide a filter like selection : where user will select Weekly, Mothly or Daily
    I would do it with grouping based expreession on primary group of report ,
    when user select daily , i just group on my date field when user select yearly i have  puted a expression to format a date to year but i dont know how to do it for weeks
    well i want like Week1 , Week2 , week3 and Week 4 or (Week 5 if) week wise data 
    Help would be appreciated !
    Dilip Patil..

    Hi Dilip Patil,
    According to your description, you want to group the data based on the parameter selection. Right?
    In this scenario, it seems you only have a date column. We can use datepart() function to get the Year, Month, Week, Day from the date column. Then use the Switch() function in Group Expression to have the records group on the parameter selection. Please refer
    to the Group Expression below:
    =Switch(Parameter!param="day",DatePart(DateInterval.Day,Fields!DateCol.Value),
    Parameter!param="week",DatePart(DateInterval.WeekOfYear,Fields!DateCol.Value),
    Parameter!param="month",DatePart(DateInterval.Month,Fields!DateCol.Value),
    Parameter!param="year",DatePart(DateInterval.Year,Fields!DateCol.Value))
    If you have any question, please feel free to ask.
    Best Regards,
    Simon Hou

  • Grouping Data Weekly

    Hi,
    I have a query in sql
    Table employees
    columns : empid,hiredate,job_id,salary
    I want to count(empid) and group data weekly with job_id , order by month.
    Sample of Data like :
    mon week job_id count(empid)
    jan week1 sa_rep 15
    jan week2 sa_rep 20
    jan week3 sa_rep 35
    jan week4 sa_rep 40
    feb week1 sa_rep 10
    feb week2 sa_rep 05
    feb week3 sa_rep 12
    feb week4 sa_rep 15
    Help please
    Thanks and Regards,
    Ramesh J C

    you can
    group by to_char(hiredate, 'IW'),  --week of year
                  to_char(hiredate, 'Month')and
    order by to_char(hiredate, 'Month')

  • Need to show a data in weeks for stacked column

      I need to show the data broken down in weeks if you choose the start date and end date.   I have to show in a stacked column chart. I am trying to show the values if you choose for example last month i need to show it by weeks for example 
    week    user name   total approved first approved    last aprovedDate  totalitemsAdded
    week 1   XYZ                 3                10/01/2012       10/05/2012         5
    week2   XYZ                  5                 etc                      etc            
      etc
    week 3 
    Below is the code and the result  i am getting now . 
    Current Results
    UserName TotalApproved
    FirstApprovedDate LastApprovedDate
       TotalItemsAdded
    XYZ            9
               2011-11-19 16:56:49.960
         2011-11-19 18:18:20.783
                   2
    DECLARE @StartDate DATETIME
    DECLARE @EndDate DATETIME
    SET @StartDate = '10/1/2012 '
    SET @EndDate = '10/31/2012'
    ;with Items as(
           SELECT
                  UserName = Profile.Description,
                  TotalItems = COUNT(TransactionID),
                  FirstAddedDate = MIN(UTCDate),
                  LastAddedDate = MAX(UTCDate)
           FROM Transactiondatabase.dbo.transaction
                    JOIN Biography.dbo.Profile ON transaction.ProfileId = Profile.ProfileID
           WHERE 
                  Data like '%ItemAdded%'
                    AND UTCDate BETWEEN @StartDate AND DATEADD(dd,1,@EndDate)
           GROUP BY
                  Profile.Description 
    Approved as
           SELECT 
                  UserName = Profile.Description,
                  TotalApproved = COUNT(TransactionID),
                  FirstApprovedDate = MIN(UTCDate),--Demo
                  LastApprovedDate = MAX(UTCDate)                 
           FROM Transactiondatabase..transaction
                    JOIN Biography.dbo.Profile ON transaction.ProfileId = Profile.ProfileID
           WHERE 
                  Data like '%Approved%'
                    AND UTCDate BETWEEN @StartDate AND DATEADD(dd,1,@EndDate)
           GROUP BY
                    Profile.Description
    Select Distinct Approved.*, TotalItemssAdded = sum(distinct Items.TotalItems)
    from Items, Approved  
    Group by Approved.UserName, Approved.FirstApprovedDate, Approved.LastApprovedDate, Approved.TotalApproved
    using ssrs 2005 

    Hi Sunny04,
    If I understand correctly, you want to display the data by weeks in a stacked column chart. If in this case, we can add a calculated field named week to display the week name, and then group it. For more details, please see the following steps:
    Right-click the dataset to add a calculated field with the values below:
    Name: Week
    Calculated field: =DatePart(DateInterval.WeekOfYear,Fields!FirstApprovedDate.Value,0,0)
    Add Week field to category group area in a stacked column chart.
    Right-click Week field to open the Properties dialog box, modify the expression of Label to like this:
    ="week"&Fields!Week.Value
    Add TotalApproved or TotalItemsAdded field to data area in the chart.
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • How to Avoid overlapping data label values in Pie Chart

    Hi,
    I am facing the problem when the data is more my pie chart data label value is overlapping.
    I tried with showing outside the data label value but customer is not accepting ,and i used the CollectedPie  option also but still its overlapping .So please any body knows how to resolve this problem as i need very urgent basis.
    Regards,
    HariKan
    HariKan

    Hi HariKan,
    Per my understanding that the Category group of the pie chart which will retuen many values so that the label will overlapping and you want to know is any method to deal with this kind of problem, right?
    In Reporting Services, when enabling data label in par charts, the position for data label only have two options: inside and outside.
    In your scenario, I recommend you to increase the size of the pie chart if you insist to choose the lable inside the pie chart as below:
    If you choose to "Enable 3D" in the chart area properties and choose to display the label outside, the label's layout will be more clear:
    Reference:
    Pie Charts (Report Builder and SSRS)
    Position Labels in a Chart (Report Builder and SSRS)
    If you have any question, please feel free to ask.
    Best regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Adding Spacing Between Groups of Bars in a Bar Chart

    I am using Word 2010. How can I add a subtitle to a grouping of bars (that each set of two bars has a descriptive title) as well as additional spacing between the groups of bars. In other words, if I have two sets of two bars in two separate "categories"
    that in both categories the two sets of bars are labeled as "Trial 1" and "Trial 2", I want to add a "category" subtitle under each "Trial 1" and "Trial 2" bar grouping as well as additional spacing between
    these two sets of two bars (that is greater than the spacing between the two sets of two bars for each category) to help make the distinction between the two categories of bars.

    Hi CyberAmazon54.
    Per my understanding that you have designed an Bar chart and have two category groups, you want to add space between each category group and also add subtitle for the category, right?
    I have tested on my local environment and use some sample data to design the bar chart like below:
    Details information below about how to design the bar chart for your reference:
    1. I assumed you have three kind of values in Category group1(HotelName:A,B,C) and you need to add some blank values for Categroup2(RoomType) to make this group display between A,B,C as the blank bar like the add the space between, Modify the query like
    below:
    SELECT HotelName, RoomType, totaloccupancy1,1 as Bar_Sort
    FROM TableName
    where HotelName='A'
    Union All
    Select '1' as HotelName
    , '' as RoomType
    , 0 as totaloccupancy1
    ,2 as Bar_Sort
    Union All
    SELECT HotelName, RoomType, totaloccupancy1,3 as Bar_Sort
    FROM TableName
    where HotelName='B'
    Union All
    Select '2' as HotelName
    , '' as RoomType
    , 0 as totaloccupancy1
    ,4 as Bar_Sort
    Union All
    SELECT HotelName, RoomType, totaloccupancy1,5 as Bar_Sort
    FROM TableName
    where HotelName='C'
    Note: the field " Bar_Sort " will be used to order the bar group.
    2. Right click the category group1(HotelName) to select the Category group properties and add below expression in the label add your subtitle in each bar group:
    =Switch(Fields!HotelName.Value="A","SubTitle1" & chr(10)& Fields!HotelName.Value,Fields!HotelName.Value="B", "SubTitle2" & chr(10)&Fields!HotelName.Value,Fields!HotelName.Value="C","SubTitle3"
    & chr(10)& Fields!HotelName.Value,Fields!HotelName.Value="1" or Fields!HotelName.Value="2",Nothing)
    3. Click the sorting to sort the bar group by the "Bar_Sort ":
    If you still have any problem, please feel free to ask.
    Regards,
    Vicky Liu
    Vicky Liu
    TechNet Community Support

  • Help with excel grouped data and sorting to keep data intact

    I have a master spreadsheet with lots of data. I am trying to grouped the data based on physical address/city, add the values and once done sort it by valuation based on descending order by valuation but my data keep messing up.
    So in Row 1/col A: Address 1; Col B City: XXX; Col C: Valuation $$$
    Row 2/col A: Address 1; Col B City: XXX; Col C: Vauation $$$
    Row 3/col A: Address 2; COl B City: YYY; Col C:  Valuation $$$
    SO I sort by city and in ROw 1/2 same city with same address, I grouped it.  THen I created a new row below Row 3 and add up the grouped data (i.e. ROw 1 and 2).  I go through the entire list to finalize the grouped locations.  
    But when I am done and I sort by Valuation, all my data messed up coz I created a new row with addition of grouped location valuation and the formula gets messed up.
    Any one with ideas please help.  My deadline for this project is just a week away and I am freaking out.
    THanks in advance.

    it seems upload a sample is more clearly about the required.
    KR

  • [Forum FAQ] How do I export each group data to separated Excel files in Reporting Services?

    Introduction
    There is a scenario that a report grouped by one field for some reasons, then the users want to export each group data to separated Excel files. By default, we can directly export only one file at a time on report server. Is there a way that we can split
    the report based on the group, then export each report to Excel file?
    Solution
    To achieve this requirement, we can add a parameter with the group values to filter the report based on the group, then create a data-driven subscription for the report which get File name and parameter from the group values.
    In the report, create a parameter named Name which use the Name field as Available Values (supposing the group grouped on Name field).
    Add a filter as below in the corresponding tablix:
    Expression: [Name]
    Operator: =
    Value: [@Name]
    Deploy the report. Then create a data-driven subscription with Windows File Share delivery extension for the report in Report Manager.
    During the data-driven subscription, in the step 3, specify a query that returns the Name field with the values as the group in the report.
    In the step 4 (Specify delivery extension settings for Report Server FileShare), below “File name”option, select “Get the value from the database”, then select Name field.
    Below ‘Render Format’ option, select Excel as the static value.
    In the step 5, we can configure parameter Name “Get the value from the database”, then select Name field. 
    Then specify the subscription execute only one time.
    References:
    Create a Data-Driven Subscription
    Windows File Share Delivery in Reporting Services
    Applies to
    Reporting Services 2005
    Reporting Services 2008
    Reporting Services 2008 R2
    Reporting Services 2012
    Please click to vote if the post helps you. This can be beneficial to other community members reading the thread.

    Thanks,
    Is this a supported scenario, or does it use unsupported features?
    For example, can we call exec [ReportServer].dbo.AddEvent @EventType='TimedSubscription', @EventData='b64ce7ec-d598-45cd-bbc2-ea202e0c129d'
    in a supported way?
    Thanks! Josh

  • Start to finish, grouped data to xmlp

    Can anyone outline for me the best process by which I would query multi-level grouped data, generating subtotals in the database, and then pass that data to the XML publisher report, with the notion of grouping and subtotals communicated to the report? I don't want to perform the grouping in the report, as it involves large numbers of records. I can find in various places how to generate XML from the database using SQLX, but I don't understand how to get that XML to be used in a report as a datasource. I can paste it in as a query in the MS Word Template builder, but don't know how to get it into the XMLP Enterprise side of things.
    So, given this example query, could someone tell me how to get the data and the meaning of the data into XMLP?
    select emp.deptno,emp.mgr,emp.empno, sum(emp.sal)
    from emp inner join dept
    on (emp.deptno=dept.deptno)
    group by
    rollup(emp.deptno,emp.mgr,emp.empno)

    Oh, yes, I've tried...but I'm at a loss as to how to put the various pieces of XML Publisher together with a data template in the mix. Can anyone give an example of how one would actually go from my example query through data template and .rtf template to final report in XML Publisher Enterprise?

  • How to group data from two tables ?

    Hello,
    I have two tables and i want to group data from them but two table not linked.
    Table TEXT_IN : ID_IN (primary_key), DATE_IN
    Table TEXT_OUT : ID_OUT(primary_key),DATE_OUT
    Example :
    Result :Group Date and Order by IN,OUT
    And It seems a bit
    confusing because we do not link
    .You can give me solutions.
    Thank you.

    SELECT MAX(CASE WHEN Rn = 1 THEN [IN] END) AS [IN1],
    MAX(CASE WHEN Rn = 1 THEN [OUT] END) AS [OUT1],
    MAX(CASE WHEN Rn = 2 THEN [IN] END) AS [IN2],
    MAX(CASE WHEN Rn = 2 THEN [OUT] END) AS [OUT2],
    MAX(CASE WHEN Rn = 3 THEN [IN] END) AS [IN3],
    MAX(CASE WHEN Rn = 3 THEN [OUT] END) AS [OUT3],
    MAX(CASE WHEN Rn = 4 THEN [IN] END) AS [IN4],
    MAX(CASE WHEN Rn = 4 THEN [OUT] END) AS [OUT4],
    MAX(CASE WHEN Rn = 5 THEN [IN] END) AS [IN5],
    MAX(CASE WHEN Rn = 5 THEN [OUT] END) AS [OUT5],
    FROM
    SELECT COALESCE(m.DATE_IN,n.DATE_IN) AS DATE_IN,
    COALESCE(m.Seq,n.Seq) AS Seq,
    ID_IN AS [IN],
    ID_OUT AS [OUT],
    ROW_NUMBER() OVER (PARTITION BY Seq ORDER BY COALESCE(m.DATE_IN,n.DATE_IN)) AS Rn
    FROM
    SELECT ROW_NUMBER() OVER (PARTITION BY DATE_IN ORDER BY DATE_IN) AS Seq,*
    FROM TEXT_IN
    )m
    FULL OUTER JOIN
    SELECT ROW_NUMBER() OVER (PARTITION BY DATE_IN ORDER BY DATE_IN) AS Seq,*
    FROM TEXT_OUT
    )n
    ON n.Seq = m.Seq
    AND n.DATE_IN = m.DATE_IN
    )t
    GROUP BY Seq
    to make it dynamic see
    http://sqlblogcasts.com/blogs/madhivanan/archive/2007/08/27/dynamic-crosstab-with-multiple-pivot-columns.aspx
    Please Mark This As Answer if it solved your issue
    Please Mark This As Helpful if it helps to solve your issue
    Visakh
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Can you put line break in text in the data box when creating a chart.  i.e. if you have a bar chart

    Can you put line break in text in the data box when creating a chart.
    i.e. if you have a bar chart with text underneath each bar, can you break it when you’re entering it instead of manually afterwards
    Thanks

    http://help.adobe.com/en_US/illustrator/cs/using/WS3f28b00cc50711d9fc86fa8133b3ce158e-8000 .html
    See "Enter labels"

  • How to add a button to the grouped data in an AdvancedDataGrid?

    Hi,
    Can anyone please suggest how to add a button to the grouped data in the AdvancedDataGrid?
    I have tried extending the AdvancedDataGridGroupItemRenderer and using it as the groupItemRenderer but its not reflecting.
    For the leaf node the itemRenderer property works just fine.
    Please help!

    HI ,
    I want to add a push button on the ALV list out put which is comming as a pop up and I want this using classes and methods.
    I have got a method IF_SREL_BROWSER_COMMANDS~ADD_BUTTONS from class cl_gos_attachment_list  but still I am unable to get any additional button on the output ALV popup.
    Please help.
    Regards,
    Kavya.

  • Grouping data sent to servlet

    I have an applet servlet pair and I'm having trouble grouping the data coming in from various clients. Let's say there are five clients connected to the servlet on individual threads. The data from clients A, B, and C need to be grouped together, while the data from clients D and E are grouped together. In reality the exact groupings are determined at runtime by the users, but for out example let's say this is how it has worked out. My idea was to create for each group an instance of some class, let's call it simply "clientGroup" on the server that holds and processes the data for each client group. So data coming in from clients A, B or C would be placed into clientGroup1, while any data that came in from D and E would be placed in clientGroup2. To do this it seems that I need to send some sort of metadata with the actual data I'm sending from the applet to the servlet that instructs the servlet "put this data into clientGroup1" or whichever. Reflexivity seems only to be able to create new objects of class clientGroup, not reference and edit existing instances like clientGroup1 or clientGroup2. So what can I pass along with my data to instruct the servlet in which class instance to put the incoming data?

    At least you should be able to identify clients to check to which group they belong. The client should for example be logged in and its group ID should already be known at the server side. Or let the client pass a specific parameter indicating the group ID. If you can do that, then it is just easy. Declare an applicationwide Map somewhere where you use the group ID as key and the group data as value.

  • Function Module to convert date to week from Sunday to Saturday

    Hi,
    In BW the convertion date to week always give week from Monday(1) to Sunday(7)
    I'm looking for a function module to convert date to week from Sunday(1) to Saturday(7)
    Thanks
    Sebastien

    Hi,
    I think this SAP standardized. Maybe you need to create custom FM.
    You can copy SAP FM DATE_GET_WEEK. in the FORM FIRSTWEEK, I see below case,
    CASE start_weekday.
        WHEN if_calendar_definition=>c_monday.
          start_weekday_number = 1.
        WHEN if_calendar_definition=>c_tuesday.
          start_weekday_number = 2.
        WHEN if_calendar_definition=>c_wednesday.
          start_weekday_number = 3.
        WHEN if_calendar_definition=>c_thursday.
          start_weekday_number = 4.
        WHEN if_calendar_definition=>c_friday.
          start_weekday_number = 5.
        WHEN if_calendar_definition=>c_saturday.
          start_weekday_number = 6.
        WHEN if_calendar_definition=>c_sunday.
          start_weekday_number = 7.
      ENDCASE.
    Maybe you can play something here.

  • Grouping Data with JSP or JSTL

    Hi All,
    I would like to ask a question about how I can group data in JSP. Essentially, I have a DataBean (extends ArrayList) that is being returned to my JSP. The ArrayList contains HashTables. Please note that the JSP assumes the data is returned in sorted order. This JSP is not responsible for sorting the data itself.
    [UPDATED EXAMPLE]
    For example, here is what the data might look like:
    Column A Column B Column C
    1 2 3
    1 15 20
    4 5 6
    4 99 66
    7 8 9
    10 11 12
    Here is how I would use my DataBean:
    String column1Name =bundle.getString(�columnA.title�);
    String column2Name =bundle.getString("columnB.title");
    String column3Name =bundle.getString("columnC.title");
    /* Loop through the bean. */
    for (int i=1;i<myDataBean.size();i++) {
    Hashtable reportRow=myDataBean.get(i);
    String column1Value=reportRow.get(Constants.COLUMNA);
    String column2Value=reportRow.get(Constants.COLUMNB);
    String column3Value=reportRow.get(Constants.COLUMNC);
    }Question
    If I want to change my layout/display to group by a particular column. How would I do that without changing the data structure that is running my current DataBean? Below is an example of grouping by the values in ColumnA.
    ColumnA: 1
    ColumnB ColumnC
    2 3
    15 20
    ColumnA: 4
    ColumnB ColumnC
    5 6
    99 66
    ColumnA: 7
    ColumnB ColumnC
    8 9
    ColumnA: 10
    ColumnB ColumnC
    11 12
    Your help is very much appreciated.
    Thanks!

    Just curious, do people find my question unclear? Can I help clarify any points?

Maybe you are looking for

  • Anyone running WCS 6 on CentOS 5?

    I ran into an issue when trying to install and run WCS 6.0.132.0 on a clean install of CentOS 5 (2.6.18-194.3.1.el5.centos.plus) After successfully installing WCS using the option "-DCHECK_OS=false" I tried to start the WCS service with the startupsc

  • App Store and 10.6.8 - What a Mess

    I know this appears in many discussions in this area, but I have searched the web and tried everything I could find to no avail.  I will note what I have done below, so if anyone has anymore ideas that have worked, I would appreciate the lead.  Hopef

  • Connect to local SAP server from mac

    I have a Windows 2008 server  with SAP server software installed. i connect to it using my windows laptop through SAP logon pad . But now am using a macbook pro os x 10.8.2  and have no idea on how to connect to the my local SAP server. And i install

  • Problem about printing special character in bex query analyzer

    Hi, in bex query analyzer i have created one restricted key figure , in which i have substracted two date with the help of replacement path. So i got result. But i am facing one problem. when in both date, if one date is null or # then it is giving s

  • How can if figure out which contacts are in both iCloud and on my Mac?

    I keep contacts on my Mac and on iCloud.  I want to see which ones are in both databases.  Some of them automatically "linked" and others did not.  The search for showing contacts that are both a member of "my Mac" and a member of "iCloud" does not s