12 month figures

Hi, I want to create a report for 12 months, how to make a query for that?
For example:
                 Jan   Feb   Mar  Apr   May  Jun  July  Aug  Sep  Oct  Nov  Dec
Mr. A            1     0      0.5   6       7      8       4     3      2     6      2      1 
Ms B            2     3         4   5       2      0       0     0      0     1      2      3
Mr. A & Ms B are employee.
Figures under Jan is the number of days absence.
Thanks.
Raymond

Hi,
Here is the query that give result as what you want, it is similar with Keith's one i.e. :
Declare @employee1 as varchar(15)
Declare @employee2 as varchar(15)
Select @employee1 = T0.empID from OHEM T0
with (NOLOCK) where T0.empID = '[%0]'
Select @employee2 = T0.empID from OHEM T0
with (NOLOCK) where T0.empID = '[%1]'
SELECT T0.empID,
(SELECT sum(Convert(numeric, todate)-
convert(numeric, fromdate)) FROM hem1 with (NOLOCK)
WHERE MONTH(todate) = 1 AND empID = T0.empID) AS 'JAN',
(SELECT sum(Convert(numeric, todate)-
convert(numeric, fromdate)) FROM hem1 with (NOLOCK)
WHERE MONTH(todate) = 2 AND empID = T0.empID) AS 'FEB',
(SELECT sum(Convert(numeric, todate)-convert(numeric, fromdate)) FROM hem1 with (NOLOCK) WHERE MONTH(todate) = 3 AND empID = T0.empID) AS 'MAR',
(SELECT sum(Convert(numeric, todate)-convert(numeric, fromdate)) FROM hem1 with (NOLOCK) WHERE MONTH(todate) = 4 AND empID = T0.empID) AS 'APR',
(SELECT sum(Convert(numeric, todate)-convert(numeric, fromdate)) FROM hem1 with (NOLOCK) WHERE MONTH(todate) = 5 AND empID = T0.empID) AS 'MAY',
(SELECT sum(Convert(numeric, todate)-convert(numeric, fromdate)) FROM hem1 with (NOLOCK) WHERE MONTH(todate) = 6 AND empID = T0.empID) AS 'JUN',
(SELECT sum(Convert(numeric, todate)-convert(numeric, fromdate)) FROM hem1 with (NOLOCK) WHERE MONTH(todate) = 7 AND empID = T0.empID) AS 'JUL',
(SELECT sum(Convert(numeric, todate)-convert(numeric, fromdate)) FROM hem1 with (NOLOCK) WHERE MONTH(todate) = 8 AND empID = T0.empID) AS 'AUG',
(SELECT sum(Convert(numeric, todate)-convert(numeric, fromdate)) FROM hem1 with (NOLOCK) WHERE MONTH(todate) = 9 AND empID = T0.empID) AS 'SEP',
(SELECT sum(Convert(numeric, todate)-convert(numeric, fromdate)) FROM hem1 with (NOLOCK) WHERE MONTH(todate) = 10 AND empID = T0.empID) AS 'OCT',
(SELECT sum(Convert(numeric, todate)-convert(numeric, fromdate)) FROM hem1 with (NOLOCK) WHERE MONTH(todate) = 11 AND empID = T0.empID) AS 'NOV',
(SELECT sum(Convert(numeric, todate)-convert(numeric, fromdate)) FROM hem1 with (NOLOCK) WHERE MONTH(todate) = 12 AND empID = T0.empID) AS 'DEC',
(SELECT sum(Convert(numeric, todate)-convert(numeric, fromdate)) FROM hem1 with (NOLOCK) WHERE YEAR(todate) = YEAR(GETDATE()) AND empID = T0.empID) AS 'TOTAL'
from hem1 t0 with (nolock) group by T0.empID, year(todate)
having t0.empid between @employee1 and @employee2 and
YEAR(T0.toDATE) = YEAR(GETDATE())
Rgds,

Similar Messages

  • How to Automatically update current months figure in 9ke5

    Hi all
    I am working on a report that will run in the background and then update the current month figure in 9ke5
    Such as for month October for plant xxx and profit center xxx
    I know all the necessary parameters such as the comp code, period year, controlling area
    Do you know which table the statistical key figures use?
    When i do f1 i see an internal structure
    Please let me know
    Cheers

    Karthick_Arp wrote:
    978184 wrote:
    Hi.
    I have a table :
    PAYMENT_PERIOD
    ID char(10()
    DUE_DATE date
    VALID Char(1)
    In above table ID is customer's ID, DUE_DATE field contains date greater than Current Date and VALID field can contain either 'V' or 'I'. Initially when I insert row in table VALID is V and DUE_DATE is any date greater than Current Date.
    My Problem is
    When Due_Date becomes less than Current Date then VALID field should be automatically updated by 'I'.
    How can I do that?
    Thanks.Use a TRIGGER or even better have a custom Transaction-API to do the job.And what event causes said trigger to fire?
    From what we know so far, the only thing that makes the row "invalid" is the passing of time and the relation of DUE_DATE to SYSDATE. As John said, don't store VALID at all, just calculate it when needed.

  • Script calc budget whole year from last 6 month figure

    HI Expert,
    I need to write a script to calculate budget from JAN to DEC base on  last six month figure
    lets says budget 2010.
    to start to calculate 2010.JAN budget..
    i need take value from 2009.JUL to 2009.DEC  ACTUAL value for calculation..
    to calculate 2010.FEB budget..
    i need take value from 2009.AUG to 2009.DEC  ACTUAL value + 2010.JAN budget value(which is value from above after commit)  for calculation...
    to calculate 2010.MAR budget..
    i need take value from 2009.SEP to 2009.DEC  ACTUAL value + 2010.JAN budget + 2010.FEB budget value(which is value from above after commit)  for calculation...
    now i need to write the script for every month on same calculation...when the calculation formula is change...i need to change the script for 12 time....
    it may also have condition the budget is start from 2010.MARCH to 2011.FEB is depend on the property user set in dimension category. There is a property call "FIRSTPLANMONTH" = 2010.JAN which indicate the first month for the budget.
    is there any way to loop  through this script for 12 times to calculate the budget base on "FIRSTPLANMONTH" and  last six month formula....
    thanks...

    Hi,
    I have created a script in sql server that updates the system parameters on a daily basis. It produces a maxl script. I am not sure how to automate it any other way.
    Thanks,
    Nathan

  • Modelling "Last Month" figures in a Calculation View

    I am trying to create a Calc View to provide data for a report which for every slice of data should show some "this month" and "last month" data. My approach so far is to have a (graphical) Calc View which does Union of "this month" data (referred further as M) with basically the same data set (let's call it M1) where I only replace calendar month with another "calmonth1" column (I'm on SPS02 which doesn't have addmonth function yet, so had to make a Join with a month lookup table here).
    That approach works mostly fine -- I get the data for this and last month, and performance is reasonable. Except when I specifically filter the testing SQL query by Calendar Month: then the runtime jumps from 0.5 sec to 9 seconds!
    I have been able to narrow the issue down to the Union statement, where my two data sets have different fields (M.calmonth and M1.calmonth1) united in the resulting field U.calmonth. So, I guess, when I apply the filter to the field U.calmonth (effectively), the system cannot derive the corresponding values of M1.calmonth1 to cascade the filter down to dataset M, and tries to extract everything into M1, then does the Union with M, then selects what's right.
    The same thing actually happens with a Projection, which indicates the issue is not in Uniting results from two data sets but exactly with deriving "reversed selections".
    I went through HANA manuals, and the only related hint there was to have a JOIN ALL on key fields instead of a Union. I'm keeping it as a last resort, as I want to avoid scripting due to high maintenance effort.
    I would be grateful to hear about alternative designs. Thanks!

    Roman,
    You can push down your current month and last month logic into Analytical view.
    In Time Attribute view, create two claculated measure for calender month. You can build this using "NOW" function, left functions. Once you have current month create last month leveraging current month and casting (current month -1)
    Once you have these two calculated attribute ready in your Time attribute view. Bring it to Analytical view and using "if then" function you can calculate measures for Current Month and Last Month.
    This will improve performance as it avoids jumps between various engine.
    Thanks

  • FR : How to change from monthly to YTD or quarter data in the same report

    Hi,
    We have several basic reports with 12 month in columns with monthly figures. We would like to try to improve these reports with 2 options (and not creating new reports):
    - For each month, we would like to choose between monthly & year to date figures. (we do not have a view dimension with YTD member)
    - In our period dimension we also have quarter members. How to choose between displaying month or quarter with the prompts ? (ie without having to select each month one by one)
    Does it is possible to do this with FR without adding a new dimension for monthly or YTD data?
    thanks!
    Tipiak

    Hi Tipiak,
    In order to show YTD Actual figure for the selected month, I was doing something like that
    - Add a hidden col from Jan to Run Time period selected.
    - Add a visible formula col and add the formula showing the total of the hidden col.
    Your requirement seems more complex but you might meet some part as an initial step maybe...
    Regards,
    Ahmet

  • Monthly G/L account

    Hi all
    I need to prepare a customized Financial Statement report which contain monthly figure for every g/l account.
    I tried using BKPF and BSEG with two select and loop statement. however I cant get all amount (dmbtr) for particular period. This is my code
    SELECT bukrs belnr gjahr monat
        INTO CORRESPONDING FIELDS OF TABLE itab
        FROM bkpf
        WHERE bukrs IN p_bukrs
        and gjahr IN p_gjahr
        and monat IN p_monat.
    LOOP AT itab.
      SELECT belnr saknr hkont shkzg koart dmbtr
        INTO CORRESPONDING FIELDS OF TABLE itab2
        FROM bseg
        WHERE belnr = itab-belnr
        AND bukrs = itab-bukrs
        AND gjahr = itab-gjahr
    ENDLOOP.
    In the first select statement, it list out Document No for particular year and period.
    But when it comes to second select, it will list out Doc No for all period in the particular year.
    Is there any other way to do this monthly g/l acc? Any suggestion is very much appreciated.
    Regards

    hi,
    change your code:
    LOOP AT itab.
    SELECT belnr saknr hkont shkzg koart dmbtr
    INTO CORRESPONDING FIELDS OF TABLE itab2
    FROM bseg
    WHERE belnr = itab-belnr
    AND bukrs = itab-bukrs
    AND gjahr = itab-gjahr
    MODIFY itab2. ==> add this line
    ENDLOOP.
    however technically it is very slow, better to use FOR ALL ENTRIES:
    LOOP AT itab. ==> comment this line
    SELECT belnr saknr hkont shkzg koart dmbtr
    INTO CORRESPONDING FIELDS OF TABLE itab2
    FROM bseg
    FOR ALL ENTRIES IN itab ==> add this line
    WHERE belnr = itab-belnr
    AND bukrs = itab-bukrs
    AND gjahr = itab-gjahr
    ENDLOOP. ==> comment this line
    hope this helps
    ec

  • Trial Balance Report not showing in months

    Hi All.
    A client is trying to run a trial balance, wanting it to display in months.
    He chooses monthly report, but it still gives just one total amount.
    The company he is running is a seconday company.
    He ran the report in the main company and it works fine..it shows the trial balance in months.
    Edited by: Jerusha Lala on Feb 18, 2010 8:17 AM

    Hi Jerusha,
    Have a look at the Posting period.  The reason could be the posting period was set up with "Year" instead of 'month'.
    If the posting period was set up with "Year", when a transactions is recorded, they will all belong to eg: 201001.
    If the posting period was set up with "Month" and subperiod=12, then when a transactions is recorded, they will be split into 201001, 201002, 201003 etc etc ... 201012.
    When positing period is not set up correctly, you will find out very soon that the standard financial report, eg: Profit and Loss will not split the information in the period as expected when running Monthly, Quarterly.
    Note that XL reports that make use of Financial period, to get Monthly figure will not work as well.
    Regards,

  • Label and legend problem in grouped month data pie chart for Crystal XI

    Post Author: mikeyplop
    CA Forum: Charts and Graphs
    Hi all, I have a problem with a pie chart I created based upon monthly figures that were grouped.  The data type is DateTime but I have modified the report to show the date as January 2007, February 2007 etc. etc.  This is all fine and appropriate as it is based on a gouping of all the data into months. However, when I chart the same data the labels and legend do not reflect this formatting.  Instead they show up as 01/2007, 02/2007 etc. etc. I have searched the forums, but was unable to find any one else who has had the same problem. Any help would be greatly appreciated. Kind regards, Mikey

    Post Author: training2go
    CA Forum: Charts and Graphs
    I've still been trying to get this to work or at least figure out what I'm doig wrong, but so far I haven't had any luck, so I'm hoping someone can help me.

  • Quarter to months drilldown problem

    Hi,
    I need to create a repprt in which i need to calculate net sales for a quarter. and then when i drilldown on the quarter i should get monthly figures.
    Can someone please tell me how to implement this.
    Thanks

    Hi ,
          Check the below links:
    [http://help.sap.com/saphelp_nw70/helpdata/EN/f1/0a56f5e09411d2acb90000e829fbfe/content.htm]
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f1a7e790-0201-0010-0a8d-f08a4662562d]
    Also check this for more info...
    [https://www.sdn.sap.com/irj/sdn/advancedsearch?cat=sdn_all&query=stepstocreateuserexit+variable&adv=false&sortby=cm_rnd_rankvalue]
          Hope this helps you. Assign points if it helps you.
    Regards,
    Yokesh

  • Count function on months column gives wrong result

    Hi,
    I am on OBIEE 11.1.1.7.150120.
    I used the count function on the month column and rather than getting 12 as the answer i get 365. (i used a filter on the year column to restrict it to one year)
    How could this happen?
    Any help would be appreciated.

    I was able to get the answer as 12 on the month column in the Dim_Time using the count distinct.
    The main reason i was trying this is because i have a VALUE column in VIew_A. I am trying to sum the values of these, but when i use the sum function, the output is quite huge and wrong. I dosen't match with the monthly figures.
    For eg:
    Month
    Income Cost
    JAN
    186.96
    FEB
    309.29
    MAR
    246.82
    APR
    247.95
    998.76
    1,462.74
    MAY
    160.27
    645.60
    1,643.84
    JUN
    172.19
    693.61
    927.12
    JUL
    150.27
    605.32
    855.89
    AUG
    133.61
    483.66
    538.20
    789.22
    SEP
    144.56
    412.42
    582.34
    824.84
    OCT
    264.96
    315.66
    364.00
    631.32
    1,067.32
    1,466.22
    NOV
    240.39
    832.10
    968.32
    1,058.73
    1,638.38
    DEC
    215.81
    857.30
    869.31
    24005.34
    But if i use the sum function on the Income/cost column, the value i get is
    C_MONTH
    SUM(INCOME_COST)
    JAN
    5,795.86
    FEB
    8,660.21
    MAR
    7,651.52
    APR
    81,283.62
    MAY
    75,941.13
    JUN
    53,787.67
    JUL
    49,955.96
    AUG
    60,285.39
    SEP
    58,924.80
    OCT
    127,394.01
    NOV
    142,137.76
    DEC
    60,215.18
    This just doesn't work out. I need the answer to be 24005 by using the sum function

  • PCA report rolling figure

    we are extending S_alr_87013326  and create a new ABAP report to include  rolling 6 months of actual number.
    can we use GRR3 or report painter, which library is S_alr_87013326 belonging to?
    if we use ABAP code, then which table we should use to get rolling 6 month figure?
    thanks

    please don't create a new ABAP report
    instead copy the report/form to a customer report/form and extend the fields there
    transaction GRR3 is for viewing reports
    you can also execute them here, but you do this trough report groups (tc GR55)
    maintanance for report painter reports is GRR2, for report writer reports GR32, for drill down reports (your case) KE82
    cheers
    matej

  • To display summary based on monthly comparison.

    Hi all,
    I have the main query to display my result which include the whole year data ( 01/01/2010 - 31/12/2010 ) but I need to show it in the monthly column such as Jan-2010, Feb-2010, Mar-2010 till Dec-2010. I can't to summaries all in the main query because there are other calculation involved in formula columns. I was able to view have my vertical column with difference month. In order to have 12 difference formula column to have the 12 difference month figure. Does any one has idea to display that ?
    Example data
    Product____Qty___Date
    100_______5_____31/01/2010
    200_______50____5/02/2010
    100_______200___01/03/2010
    required output...
    Product _____ 31/01/2010______28/02/2010_____30/03/2010
    100_________5_______________0_____________200
    200_________0_______________50____________0
    Thanks.
    Lim

    When creating this matrix report, you should base it not on your date, but on last day of the month.
    select last_day(to_date('05/02/2010','dd/mm/yyyy')) ld from dual;
    LD      
    28-FEB-10

  • What is the average monthly Mb in updates for A new iMac

    I have A download cap of  10gb per month do I need to increase my download package

    I don't think you could pick an average monthly figure. It varies wildly depending on how many apps you have installed (not only Apple apps). Occasional updates to the OS itself seem to roll out every two or three months and could be 500mb-1gb in size. Downloading the OS in its entirety is 5.3gb, although you should hopefully only need to do that rarely and only when you needed to re-install and you didn't have a copy of the installer.
    Factor in your everyday use of the internet and it's a difficult one to answer with any accuracy.
    How rigid is your ISP with the data cap, and can you increase it on 'as required' basis.

  • Can I build a query to show monthly sales by item by business partner?

    Hi all
    Is it possible to build a query to show monthly sales (quantity not value) by item by business partner?
    So the table would look something like this.
                   Jan     Feb     Mar     Apr
    Item 1      10       4         8         7
    Item 2      4         3         5         6
    Item 3      4        12        9         3
    Item 4      1         0         1         2
    Etc...
    As you can see, the monthly figure needs to be quantity of the item and not sales value.
    Would be grateful for any help.
    Many thanks.
    Wendy

    Hi,
    Try this:
    declare @code as varchar(15)
    set @code = ( select max(ta.cardcode) from OINV ta where ta.cardcode = [%0])
    Select [a] as Cardcode, [B] as Cardname, [c] as Item#, [D] as Descr,[1] as Jan,[2] as Feb,[3]as Mar,[4] as April,[5] as May,[6] as June,[7] as July ,[8] as Aug,[9] as Sept,[10] as Oct ,[11]as Nov,[12] as Dec
    from(
    SELECT T0.[CardCode] as  A , T0.[CardName] as  B, T1.[ItemCode] as C, T1.[Dscription] as D, sum(T1.[Quantity]) as t,month(T0.[DocDate]) as month FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry WHERE year( T0.[DocDate]) = 2014 and t0.cardcode = @code GROUP BY T0.[CardCode], T0.[CardName], T1.[ItemCode], T1.[Dscription],T0.[DocDate] ) S
    pivot
    (sum(t) for month IN ([1],[2],[3],[4],[5],[6],[7],[8],[9],[10],[11],[12])) P
    Thanks & Regards,
    Nagarajan

  • Monthly fee after upgrade not honored

    I upgraded my phone in March. Was paying $81/mo, confirmed monthly figure would stay about same. It's now $100/mo. According to the chat this was not supposed to be the case. Please advise.
    <Chat transcript removed per the Verizon Wireless Terms of Service for proprietary information.>
    Message was edited by: Verizon Moderator

    To send her a Direct Message:
    ArnettH_VZW click on her username here and go to her profile page. Then click on the follow request. She has to approve the request and send one back to you. You will have to accept that follow request before you can send her a direct message.

Maybe you are looking for

  • GRC PC3.0 Task name in work inbox = WI Text - cannot access the task detail

    Hi all We are using PC 3.0 -ECC6 has been upgraded to 6.05 We cannot access PC tasks from the work inbox - this is true for all the users We can view the task - task name = WI TEXT Cannot click on the object name to get to task details Your help will

  • BD87 idoc inbound error for message type HRMD_A

    Hello there, I am getting below error  while fetching Inbound idoc in tcode BD87, see log below from ST22 Short text     An SQL error occurred when executing Native SQL. What happened?     The error "-10328" occurred in the current database connectio

  • How to run the form?

    Dear all, I also have another question about forms. Again, I am new to learning Forms. I have developed a form application and it runs in my PC. How do I make it available to the users? I read through the documentation and I see that I can make it av

  • FCC Receiver

    I have to convert my input message which is xml format to flat file format My Input XML format is like this: <Header> </Header> <Body>      <Child>      </Child> </Body> <Footer> </Footer> Header,Body and Footer are in same level. So,now my question

  • My ipod 4th generation is stuck on apple screen.

    Idk what to do.. it really ***** but it goes from apple screen for like 20 minutes to white screen for a few seconds and keeps repeating. idk what to do.... My home button doesn't work because it is jammed but my lock button works fine. please please