Month wise count
Hi all,
i am using oracle 11.2.0.3.0 version. i need to calculate month wise count. see below table, the date
like 'MM-DD-YYYY'.
claims from_date end_date member
C1 11/06/2012 11/20/2012 M1
C1 11/02/2012 11/20/2012 M1
C1 11/04/2012 11/15/2012 M1
C1 10/07/2012 10/15/2012 M1
C1 09/08/2012 09/09/2012 M1
C2 05/07/2012 05/08/2012 M1
C2 06/09/2012 06/15/2012 M1
I need the output like below
claims from_date end_date member count(claims) count(member)
C1 11/06/2012 11/20/2012 M1 3 3
C1 11/02/2012 11/20/2012 M1 3 3
C1 11/04/2012 11/15/2012 M1 3 3
C1 10/07/2012 10/15/2012 M1 1 1
C1 09/08/2012 09/09/2012 M1 1 1
C2 05/07/2012 05/08/2012 M1 1 1
C2 06/09/2012 06/15/2012 M1 1 1
Thanks.
Edited by: 980659 on Jan 8, 2013 8:07 PM
980659 wrote:
I need the output like below
claims from_date end_date member count(claims) count(member)
C1 11/06/2012 11/20/2012 M1 3 3
C1 11/02/2012 11/20/2012 M1 3 3
C1 11/04/2012 11/15/2012 M1 3 3
C1 10/07/2012 10/15/2012 M1 1 1
C1 09/08/2012 09/09/2012 M1 1 1
C2 05/07/2012 05/08/2012 M1 1 1
C2 06/09/2012 06/15/2012 M1 1 1
Thanks.
Edited by: 980659 on Jan 8, 2013 8:07 PMWith your changed output, you could use
select claims, from_date, end_date, member,
count(*) over(partition by to_char(from_date,'yyyymm') order by null) claim_count,
count(*) over(partition by to_char(from_date,'yyyymm') order by null) member_count
from your_table;FROM_DATE and TO_DATE are expected in the same month
Similar Messages
-
Display schedule qty - Month wise in ALV Grid
Hi Experts,
I have a requirement to display the schedule line quantities month wise in ALV Grid. The columns sholud be dynamic columns based on the input date range. I got some idea about how to create dynamic ALV but it is not clear to implement in my requirement.
Please Guide me in achiving the same.
Example:
Jan 2011 Feb 2011 March 2011
100 2000 300
Thanks&Regards,
KarthikHi.,
Create field catalog dynamically as like this.,
select-options s_date for sy-datum.
data: n type i,
count type i,
cnt type string,
field type string,
descr type string.
DATA: m TYPE t247-mnr,
month_name type char10,
m1 type i.
n = s_date-high+4(2) - s_date-low+4(2) . " getting number of months
m1 = s_date-low+4(2).
m = m1.
n = n + 1.
DO n TIMES. " building field catalog dynamically
m = m + 1.
count = count + 1.
cnt = count.
concatenate 'FIELD' cnt into field.
CALL FUNCTION 'ISP_GET_MONTH_NAME' " FM to get month name
EXPORTING
LANGUAGE = sy-langu
MONTH_NUMBER = m
IMPORTING
* LANGU_BACK =
LONGTEXT = month_name .
concatenate month_name s_date-low+0(4) into descr separated by ''.
wa_fieldcat-col_pos = count.
wa_fieldcat-row_pos = '1'.
wa_fieldcat-fieldname = field.
wa_fieldcat-seltext_m = descr.
append wa_fieldcat to it_fieldcat.
clear wa_fieldcat.
ENDDO.
After this create dynamic table using,
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fldcat
IMPORTING
ep_table = t_newtable.
then loop the internal table and assign the component to final internal table,.
like .,
CONCATENATE 'FIELD' index INTO fieldvalue. " do same like fieldcatalog
ASSIGN COMPONENT fieldvalue OF STRUCTURE <fs_dyntable> TO <fs_fldval>.
<fs_fldval> = wa-fieldvalue.
hope this helps u.,
Thanks & Regards,
Kiran -
Stock report with value and qauntity for given date not month wise
Hi gems,
can any body give me the standard report for Stock value and qauntity for given date not month wise at storage location levelHi
check the report S_P00_07000139 with the option inventory and raw material report- detail and selection date (from, to date same). List will give opening & closing balances with goods movment and their values.
Thanks -
Hi all,
I have my data in the table as date wise. I need to sum this data in month wise.
Can anyone tell me how to do it. Is their any fm to do it or any sample pgm of this kind.
For ex my output should be like this :
field1 field2 Month1 Month2 Month3 Month4 ..
Waiting for reply,
Regards,
Priyahi priya,
First of all sort the whole set of values as per date wise into an internal table.
Sort the table as per the date .
CONCATENATE PR_MONTH '01' INTO W_FIRST_DATE.
CALL FUNCTION 'LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = W_FIRST_DATE
IMPORTING
LAST_DAY_OF_MONTH = W_LAST_DATE
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
W_DATE = W_FIRST_DATE.
With this try to determine the first and last days of the month
From where u want to start .
Capture the month field from date field into pr_month.
Set the first date of the month to 01 like 02/01/2006
Suppose u had 02/02/2006 as the first occurance of the date then
U r trying to determine the first date and last date of ur feb month for the year 2006 .
Now 02/01/2006 and 02/28/2006 are determined by this process .
Set date_low = 02/01/2006 .
Date_high = 02/28/2006.
Now into ur select statement capture the fields between 02/01/2006 and 02/28/2006 just like range .
U can use select between or range
,so this covers all the fields for feb ,
Use collect on ur final output table which will give u the final sum values.
Now next field is say 03/10/2006 , then use the same process to capture the values .
Itab say is containg date fields
Logic is
Loop at itab.
Month = itab-date+(x)
At new month.
Perform operation .
Endat.
Endloop. -
Display information on Month wise
We have one requirement and we need to display the Month wise information on the report (Sysdate - 1, sydate -2 ....etc)
for example today is 08 Sept 2011 In template level we need to display below
Sept 2011 Aug 2011 Jul 2011 Jun 2011 May 2011 Apr 2011
Please let me know if it's possible to do in RTF Template.Pull all the required date and data from DB using queries,.
-
Hi
I have a requiement , I need to display a report which will give sales target and Actual , month wise for respective sales representative
the format is as follows
Sales Representative Jan feb upto Dec
target Actual target Actual
I have a ODS which will give the Actual Fig and I am using a flat file to upload the target values into another ODS
I will use a Infoset or multiprovider to merge it
Pl suggest how to go about it ?
I mean do I need to create 12 Target Infoobjects(Key Fig)
and how i will do mapping and compare month wise target and actual values
regrds
kisholoyHi kisholoy,
According to me u need not to have separate ODS for the Target figures, u can have the target data into the Actual figure ODS with different infosource arrangement for the Target figures.
I have done such thing previously and it works fine in the same situation.
Well at a reporting side u can keep Sales representative in selection so that viewer can see report for the perticular sales representative or can see for all sales representative.
For this arrangement follow the things i have mentioned hereabove.
1. create a structure for the months in a year. PS: Also put Fiscal year in Selection. (Put this fiscal year and sales representative in the Free characteristics.)
2. Show Text and key for sales representative by ticking ovet this display option in the properties.
3. Go in the Columns create strcture for actual and target figures.
Thus ur query is ready. Do some additional settings as per custemer need.
Hope it helps.
Assign the points if it works. -
Hi,
I have a requirement as follows :-
The user will submit the start date and end date. Based on the date parameters, the customized procedure should do some calculations month-wise.
For eg : start date - 01-Dec-2012 to end date - 31-Mar-2013
I want the break up as
Start date End date
01-dec-2012 31-dec-2012
01-jan-2013 31-jan-2013
01-feb-2013 28-feb-2013
01-mar-2013 31-mar-2013
How can i achieve this month-wise break ?
Regards,Hi,
There are no DATE bind variables, at least not in SQL*Plus.
You can use VARCHAR2s to pass the start and end dates, like this:
VARIABLE start_date VARCHAR2 (11)
VARIABLE end_date VARCHAR2 (11)
EXEC :start_date := '02-Dec-2012';
EXEC :end_date := '31-Mar-2013';
WITH got_months AS
SELECT TRUNC ( TO_DATE (:start_date, 'DD-Mon-YYYY')
, 'MONTH'
) AS first_month
, TRUNC ( TO_DATE (:end_date, 'DD-Mon-YYYY')
, 'MONTH'
) AS last_month
FROM dual
SELECT ADD_MONTHS (first_month, LEVEL - 1) AS month_start
, ADD_MONTHS (first_month, LEVEL ) - 1 AS month_end
FROM got_months
CONNECT BY LEVEL <= 1 + MONTHS_BETWEEN ( last_month
, first_month
;Output:
MONTH_START MONTH_END
01-Dec-2012 31-Dec-2012
01-Jan-2013 31-Jan-2013
01-Feb-2013 28-Feb-2013
01-Mar-2013 31-Mar-2013 -
hai,
i m working on sales report where in i need to get month wise sales of the products and the related cost incured to company by the sales in the matrix form as shown below can u help me in which way can i get this monthly report
march april may june july......feb
mtrl 25 30 0 19 23 ........(mtrl quantity)
cost 30000 15000 0 45000 ..........(amt in rs)
where in the above i m able to get yearly sales in one column (i.e i m able to show for one particular customer total sales in one column) but i m unable to split sales monthly and unable to show in a report so how can i able to sow in this matrix formDear Raj,
Please find the code for monthly wise report in PA0001 Table for calculation of Administrator time Recording.
http://scn.sap.com/message/14216250#14216250 -
Monthly wise Sales report - Help me
Dear SDN mates
Is there any standard reports for Monthly wise sales report ...the SAP1 , SAP2 reports were not helpful....Does this can be solved by standard reports or it needs to be customized????
kindly help me?hi,
check VC05 transaction. -
How to get monthly wise asset depriciation
Hi all,
I am developing a report to show mothly wise depreciation for an Asset.
In transaction 'AW01 - Assset Explorer' if we give company code, Asset number and Fiscal
year we get the details of the depriciation in 'Planned/Posted Depriciation values'. I want to get
the same result.
By debugging the transaction AW01 i got the funtion module 'AM_SHOW_POST_DEPR' which
gives the monthly wise depreciation value as output.
But I am not getting what are the exact inputs which we need to pass to the funtion module.
So pls help to find out monthly wise asset depriciation for an asset through the same funtion module or some other simple funtion module or through the tables.
Regard's,
Jean.hi,
please refer this link
How to get specific acquisitions and related depreciations?
thanks -
How to find the month wise Overall result
Hi,
calculating share percentage of order quantity based on Overal result.
if given the fiscal period range in the variable(for ex 001.2006 to 009.2006) Overall result considering sum of all Order quantity data between this range.
But need to calculate share percentage based on month wise in this fiscal period range,for this regard should consider the sum of overal result in month wise.
How to calculate the month wise overall result?
regards,
Hari.Hi Hari,
You need to enable the results row for your Month char in the query. Then use a new formula with the function %CT to get the percentage share of individual values wrt to overall result of that month.
Hope this helps... -
GRR3 report is not showing cost centers monthly wise totals
Hi,
we are having cost center report for full year company code currency report which was working in R3 system. after upgrade it is not showing monthly wise total currency values but when drill down it to actual line item level it is showing all totals. can anybody hlep me to identy issue.
Thanks,Dear Venu
Check any other standard summarisation report and see whether they are giving data or not. If not you need to implement note 1817039 to fetch summarisation data. But before that I suggest once again you do data collection upto the period and try running your report.If no success then read the note and apply it.
Regards
Rajneesh Saxena -
Hi ,
How to get page wise count of rows of the inner repeating group?
Thanks in advance.
--Basava.SHi Dimant,
I used countrows. If the dataset set contains 12 rows I am getting the o/p as shown below. I just need one row. Can please help me out.
Thanks
sush -
Report to view the batch details of the products sold month wise
Report to view the batch details of the products sold month wise.
Please send it .Dear Goutam
Use <b>MB51</b> where you can select the field "Batch".
Thanks
G. Lakshmipathi -
How to get database growth month wise
Hi All,
Can any one help me getting the growth of production database month wise for the current year.
I mean I need a script which will display the growth of my database month wise for the year 2010.
Regards,hi,
try something along the lines of this
--Run the following create table to create segment info.
create table stats$segment_info as
select
sysdate snap_time,owner, segment_name,segment_type , tablespace_name,sum(bytes) bytes from dba_segments group by owner,segment_type, segment_name,tablespace_name /
-- Run the following once a calendar month via dba_jobs.
insert into stats$segment_info
select
sysdate snap_time,owner, segment_name,segment_type , tablespace_name,sum(bytes) bytes from dba_segments group by owner,segment_type, segment_name,tablespace_name / commit;
-- run the following report to get tablesapace growth
column this_mon new_value this_mon
column last_mon new_value last_mon
column prev_mon new_value prev_mon
select to_char(sysdate,'MON YYYY') This_mon
, To_char(add_months(sysdate,-1),'MON YYYY') Last_mon
, to_char(add_months(sysdate,-2),'MON YYYY') prev_mon from dual;
column mins format 99999
column size_mb heading '&&this_mon' format 99999 column size_mb2 heading '&&prev_mon' format 99999 column size_mb1 heading '&&last_mon' format 99999
column growth heading 'Growth(%)| in |last month' format 9999.99
select tablespace_name,
-- to_char(snap_time,'MON YYYY') Month
max(decode(trunc(snap_time,'MON'),trunc(add_months(sysdate,-2),'MON'),size_m,0)) size_mb2
,max(decode(trunc(snap_time,'MON'),trunc(add_months(sysdate,-1),'MON'),size_m,0)) size_mb1
,max(decode(trunc(snap_time,'MON'),trunc(sysdate,'MON'),size_m,0)) size_mb
,100*(max(decode(trunc(snap_time,'MON'),trunc(sysdate,'MON'),size_m,0))
- max(decode(trunc(snap_time,'MON'),trunc(add_months(sysdate,-1),'MON'),size_m,0)))
/max(decode(trunc(snap_time,'MON'),trunc(add_months(sysdate,-1),'MON'),size_m,1)) growth from (select tablespace_name, snap_time
,sum(bytes)/1024/1024 size_M
from stats$segment_info
where snap_time > trunc(add_months(sysdate,-2),'MON')-2
group by tablespace_name,snap_time) a
group by tablespace_name
order by tablespace_name
/as far as I am aware this is database independent.
regards
Alan
Maybe you are looking for
-
I'm using MainStage in a scenario that requires a number of quick patch changes in tightly scripted music. In one particular situation that change is so tight that I want to assign one of the keys on the (piano) keyboard to change the patch. That is,
-
I've lost the ability to grab the corners of boxes and scale...Help!
Mac based, Illustrator CS3. I've suddenly lost the ability to grab the corners of boxes and scale in illustrator - i must have accidentally turned something off - can someone tell me what i did worng and how to fix it? It's driving me crazy to scale
-
Can you print to a lexmark interpret s405 from an ipad
Can you print from an ipad to a Lexmark Interpret S405?
-
Smartforms problem ? intersection of template boundaries
hi, in my smartform project; i am using several templates.and many of them have intersection with each other.the question is;some boundaries which are intersected with each other are visible but some of them are not.do u have any ideas?
-
Error 1335 when upgrading iTunes
I just upgraded to iTunes version 6.0.3.5. Halfway through the installation, I received ERROR 1335: "Cabinet file, 'itunes.cab' required for installation is corrupt and can't be used. I have tried typing in cmd in the command prompt, and have tried t