Grouping records by month
Hi,
I have a group of records in the XML structure as below:
<ListofIO>
<ListOfBipReport1>
<Report>
<FirstName/>
<LastName/>
<Planned>04/12/2011</Planned>
</Report>
<Report>
<FirstName/>
<LastName/>
<Planned>04/10/2011</Planned>
</Report>
<Report>
<FirstName/>
<LastName/>
<Planned>05/08/2011</Planned>
</Report>
</ListOfBipReport1>
</ListofIO>
I would like to group the records by month based on the Planned date.
I used the following code: <?for-each-group:Report;./Planned?><?sort:current-group()/Planned;'ascending';data-type='text'?>
and I formatted the Planned date to display in the format mmm-yy
I would like the report to display info as follows:
Apr-11
First Name
Last Name
First Name
Last Name
May -11
First Name
Last Name
but when I run the report what I see is the following:
Apr-11
First Name
Last Name
Apr-11
First Name
Last Name
May-11
First Name
Last Name
i.e. The grouping is displaying for every record
How do I group the Planned dates for each record together so that I see each month listed only once?
thanks
Your date needs to be in the canonical format to apply any formatting.
You could use the substring function and concat function to extract the month and year and then use that to group by.. not the best way..
Thanks,
Bipuser
Similar Messages
-
How to display empty months when grouping records by month
Guys, I've got a recordset that successfully displays all
records in the
table grouped according to the month that the record was
created in.
This allows me to display a Monthly tally (a bit like a
barchart - where the
height of the column is derived by the qty of records for
that given month)
for each of the months in the year so far. However, it dawned
on me today
that if there was no activity in a given month, the month
simply doesn't
appear at all, rather than displaying but showing "0" as I
would prefer.
For example, the type of thing I want to display onscreen is:
Month 1 2 3 4 5 6 7 8 9 10 11 12
But let's say there were no records inserted in months June
to September
(inclusive), what I'm actually getting onscreen is:
Month 1 2 3 4 5 10 11 12
But what I actually want to appear onscreen is:
Month 1 2 3 4 5 6 7 8 9 10 11 12
I hope that makes some kind of sense...
I'm using Dreamweaver CS3, ASP/VBScript, and MySQL.
My current SQL Statement is as follows:
SELECT Count(AffiliateID) AS TotalClicks, MONTH(`VisitDate`)
AS Month
FROM tbl_affiliaterefferals
WHERE `AffiliateID` = "49" AND YEAR(`VisitDate`) =
YEAR(Now()) GROUP BY
MONTH(`VisitDate`)
ORDER BY MONTH(`VisitDate`) ASC
I figured one workaround would be to have 12 separate
recordsets - one for
each month - on the one page, but there must be a cleaner way
of doing it
surely?
Any/all help greatly appreciated.
Regards
DavidThis is a multi-part message in MIME format.
------=_NextPart_000_0086_01C932EC.D9CE33D0
Content-Type: text/plain;
format=flowed;
charset="iso-8859-1";
reply-type=original
Content-Transfer-Encoding: 7bit
Hi Joe,
I've simply got a table, within one cell of which is another
table to which
I've applied a background colour and am specifying the height
of the <td>
cell as the qty of the number of records returned for Month 1
of the current
year. Then I'm applying a repeat region to the <TD>
cell containing the
table that varies in height, in order to force the table to
repeat
horizontally according to the number of records (months)
retrieved from the
database.
The code for the table is in the attached txt file.
I appreciate your time in responding however you must have
missed my
comments about what I'm working in as I'm working in
ASP/VBScript and
haven't the first clue when it comes to PHP.
I don't suppose you know or can point me in the direction of
an ASP
equivalent of your suggestion?
Regards
David
"Joe Makowiec" <[email protected]> wrote in
message
news:[email protected]...
> On 20 Oct 2008 in macromedia.dreamweaver, DTB-K wrote:
>
>> I figured one workaround would be to have 12
separate recordsets -
>> one for each month - on the one page, but there must
be a cleaner
>> way of doing it surely?
>
> Without seeing the code you're using to display it...
>
> Probably what that code is doing is looping through the
recordset:
>
> <?php do { ?>
> ...
> <?php } while ($row_dates =
mysql_fetch_assoc($dates)); ?>
>
> That's DW's standard PHP MySQL recordset behavior. What
you want to do
> is something more like:
>
> <?php
> for ($i=1;$i<13;$i++) { // Do 12 months
> echo '<p>Month: ';
> echo $i; //Echo the month
> if ($row_Recordset1['Month'] == $i) {
> // Have data for this month
> echo ' Clicks: ';
> echo $row_Recordset1['TotalClicks'];
> // Now get the next row
> // Note that we only want to get the next row if the
current month
> // has data. That's why the fetch command is inside the
if.
> $row_Recordset1= mysql_fetch_assoc($Recordset1);
> } // End if
> echo "</p>\n";
> } // End for
> ?>
>
> --
> Joe Makowiec
>
http://makowiec.net/
> Email:
http://makowiec.net/contact.php
------=_NextPart_000_0086_01C932EC.D9CE33D0
Content-Type: text/plain;
format=flowed;
name="Code.txt";
reply-type=original
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="Code.txt"
<table border=3D"0" cellpadding=3D"0"
cellspacing=3D"0">
<tr>
<td colspan=3D"2" valign=3D"bottom"><h1>Current
Year:</h1></td>
</tr>
<tr>
<td valign=3D"bottom" =
class=3D"BodyTxtsml"><strong>Month</strong></td>
<%=20
While ((Repeat1__numRows <> 0) AND (NOT
Rs_MonthlyClicks.EOF))=20
%>
<%Dim TotalClicks, Cellheight
TotalClicks =3D =
FormatNumber((Rs_MonthlyClicks.Fields.Item("TotalClicks").Value),
0, -2, =
-2, -2)
Cellheight =3D (TotalClicks)
%> =20
<td valign=3D"bottom" class=3D"BodyTxtsml" =
title=3D"<%=3D(TotalClicks)%>"><div
align=3D"center"><table border=3D"0" =
cellspacing=3D"0" cellpadding=3D"0">
<tr>
<td height=3D"<%=3D(Cellheight)%>" =
bgcolor=3D"#003366" onMouseOver=3D"this.bgColor =3D
'#FFDB9D'" =
onMouseOut=3D"this.bgColor =3D'#003366'"
width=3D"40"> </td>
</tr>
=
</table><%=3D(Rs_MonthlyClicks.Fields.Item("Month").Value)%></div></td>
<%=20
Repeat1__index=3DRepeat1__index+1
Repeat1__numRows=3DRepeat1__numRows-1
Rs_MonthlyClicks.MoveNext()
Wend
%> =20
</tr>
</table>
------=_NextPart_000_0086_01C932EC.D9CE33D0-- -
Display records according month
hi all.
i want to display records according months.
i created view something like this.
create or replace view month_timer (item1, amount,item_date) as
select item1,sum(amount),item_date
from table
where trunc(item_date) between to_date('01-jan-2010') and trunc(sysdate)
AND item_TYPE!=4
group by item1,item_date
ORDER BY item_dateany suggestions?
sarahcreate or replace view month_timer (item1, amount,item_date) as here in this statement you are using item1 and only tree columns.
select pcd_plt_id,pcd_cbr_id ,sum(amount),item_date And here in this statement there are four columns. So which column is for item1
group by item1,item_dateHere you can use only selected columns in group by. But you are using item1 which you used above for view.
And in select there are three columns without aggregate function. And you are using only two here.
If you could post the table data and desired output. Then it will be easier to find better way.
-Ammad -
How to group each 3 months of a year and dynamic a new column?
I have a sql which can display the belows records.
YEARS MONTHS SUMMONTH SUMYEAR
2009 Apr 130288 1720164
2009 Aug 138776 1720164
2009 Dec 140294 1720164
2009 Feb 136422 1720164
2009 Jan 148253 1720164
2009 Jul 149842 1720164
2009 Jun 122805 1720164
2009 Mar 145872 1720164
2009 May 151193 1720164
2009 Nov 133487 1720164
2009 Oct 169443 1720164
2009 Sep 153489 1720164
2010 Apr 142255 1719457
2010 Aug 135894 1719457
2010 Dec 171203 1719457
2010 Feb 137011 1719457
2010 Jan 145493 1719457
2010 Jul 137474 1719457
2010 Jun 154411 1719457
2010 Mar 133062 1719457
2010 May 146887 1719457
2010 Nov 139869 1719457
2010 Oct 127191 1719457
2010 Sep 148707 1719457
24 rows selected The SQL that I am using:
select years, months, summonth, sumyear
from(
select years, months, SUM (sumHour) OVER (PARTITION BY years,months) sumMonth, SUM (sumHour) OVER (PARTITION BY years) sumyear
from (SELECT x.years, x.months, x.days, x.hours, x.mins, sum(x.value) as sumHour
FROM xmltest,
XMLTABLE ('$d/cdata/name' passing xmldoc as "d"
COLUMNS
years integer path 'year',
months varchar(3) path 'month',
days varchar(2) path 'day',
hours varchar(2) path 'hour',
mins varchar(2) path 'minute',
value float path 'value'
) as X
group by x.years, x.months, x.days, x.hours, x.mins
order by x.years, x.months, x.days
group by years,months,summonth,sumyear
order by yearsand now the problems is...how can I group the sum of 3months of record as a quarter of year in a dynamic column?
The display should be likie this:
YEARS MONTHS SUMMONTH SUMQUARTER SUMYEAR
2009 Feb 136422 430547 1720164
2009 Jan 148253 430547 1720164
2009 Mar 145872 430547 1720164
2009 Apr 130288 404286 1720164
2009 Jun 122805 404286 1720164
2009 May 151193 404286 1720164
2009 Aug 138776 442107 1720164
2009 Jul 149842 442107 1720164
2009 Sep 153489 442107 1720164
2009 Dec 140294 443224 1720164
2009 Nov 133487 443224 1720164
2009 Oct 169443 443224 1720164
2010 Feb 137011 415566 1719457
2010 Jan 145493 415566 1719457
2010 Mar 133062 415566 1719457
2010 Apr 142255 443553 1719457
2010 Jun 154411 443553 1719457
2010 May 146887 443553 1719457
2010 Aug 135894 422075 1719457
2010 Jul 137474 422075 1719457
2010 Sep 148707 422075 1719457
2010 Dec 171203 438263 1719457
2010 Nov 139869 438263 1719457
2010 Oct 127191 438263 1719457
24 rows selected Thanks everyone helps me.!!may be using an outer select :
SQL> with sample_tab as
2 (
3 select 2009 year, 'Aug' month, 138776 summonth , 1720164 sumyear from dual union all
4 select 2009,'Apr',130288, 1720164 from dual union all
5 select 2009,'Dec', 140294 , 1720164 from dual union all
6 select 2009,'Feb', 136422 , 1720164 from dual union all
7 select 2009,'Jan', 148253 , 1720164 from dual union all
8 select 2009,'Jul', 149842 , 1720164 from dual union all
9 select 2009,'Jun', 122805 , 1720164 from dual union all
10 select 2009,'Mar', 145872 , 1720164 from dual union all
11 select 2009,'May', 151193 , 1720164 from dual union all
12 select 2009,'Nov', 133487 , 1720164 from dual union all
13 select 2009,'Oct', 169443 , 1720164 from dual union all
14 select 2009,'Sep', 153489 , 1720164 from dual union all
15 select 2010,'Apr', 142255 , 1719457 from dual union all
16 select 2010,'Aug', 135894 , 1719457 from dual union all
17 select 2010,'Dec', 171203 , 1719457 from dual union all
18 select 2010,'Feb', 137011 , 1719457 from dual union all
19 select 2010,'Jan', 145493 , 1719457 from dual union all
20 select 2010,'Jul', 137474 , 1719457 from dual union all
21 select 2010,'Jun', 154411 , 1719457 from dual union all
22 select 2010,'Mar', 133062 , 1719457 from dual union all
23 select 2010,'May', 146887 , 1719457 from dual union all
24 select 2010,'Nov', 139869 , 1719457 from dual union all
25 select 2010,'Oct', 127191 , 1719457 from dual union all
26 select 2010,'Sep', 148707 , 1719457 from dual
27 )
28 select year,
29 month,
30 summonth,
31 sum(summonth) over(partition by year || to_char(ym, 'Q') order by year || to_char(ym, 'Q')) sumquarter,
32 sumyear
33 from (
34 select year,
35 month,
36 summonth,
37 sumyear,
38 to_date(year || month, 'YYYYMon') ym
39 from sample_tab)
40 order by ym
41 ;
YEAR MONTH SUMMONTH SUMQUARTER SUMYEAR
2009 Jan 148253 430547 1720164
2009 Feb 136422 430547 1720164
2009 Mar 145872 430547 1720164
2009 Apr 130288 404286 1720164
2009 May 151193 404286 1720164
2009 Jun 122805 404286 1720164
2009 Jul 149842 442107 1720164
2009 Aug 138776 442107 1720164
2009 Sep 153489 442107 1720164
2009 Oct 169443 443224 1720164
2009 Nov 133487 443224 1720164
2009 Dec 140294 443224 1720164
2010 Jan 145493 415566 1719457
2010 Feb 137011 415566 1719457
2010 Mar 133062 415566 1719457
2010 Apr 142255 443553 1719457
2010 May 146887 443553 1719457
2010 Jun 154411 443553 1719457
2010 Jul 137474 422075 1719457
2010 Aug 135894 422075 1719457
YEAR MONTH SUMMONTH SUMQUARTER SUMYEAR
2010 Sep 148707 422075 1719457
2010 Oct 127191 438263 1719457
2010 Nov 139869 438263 1719457
2010 Dec 171203 438263 1719457
24 rows selected
SQL> -
Dynamically group records by date
I am attempting to create a report that will dynamically group records into a set number of date buckets. This is similar to grouping records by a date field and setting the days, weeks, months, etc property but instead of grouping by a set time span I want to a specific number of date groups regardless of date span. So say i have records where the first date is today at 1am and the last record is today at 9 pm. I want the data grouped into 10 groups and the time calculated for that group based on total time span / 10. The first group would be 1AM to 3AM, the second would group 3AM to 5AM, etc.. The reason I am doing this is for a chart that displays record counts over time but the overall timespan will never be known until runtime. Setting the chart for hourly or weekly doesn't work because if the user runs the report over a year the dates will be illegible.
Thanks in advance!Well this SHOULD be easy. But leave it to CR make not...
You can start by finding the minimum & maximum dates within your range:
Local DateTimeVar MinDate;
MinDate := Minimum({Table.DateField})
and
Local DateTimeVar MaxDate;
MaxDate := Maximum({Person.ModifiedDate})
Then figure out what the the interval would be if the span is broken down into 10 equal parts"
DateDiff("n", {@MinDate}, {@MaxDate}) / 10
From there just use a formula to segregate each records into the appropriate groups:
EvaluateAfter({@Interval});
IF {Table.DateField} >= {@MinDate}
AND {Table.DateField} <= DateAdd("n",{@Interval}, {@MinDate}) THEN 1 ELSE
IF {Table.DateField} > DateAdd("n",{@Interval}, {@MinDate})
AND {Table.DateField} <= DateAdd("n",{@Interval} * 2, {@MinDate}) THEN 2 ELSE
IF {Table.DateField} > DateAdd("n",{@Interval} * 2, {@MinDate})
AND {Table.DateField} <= DateAdd("n",{@Interval} * 3, {@MinDate}) THEN 3 ELSE
IF{Table.DateField} > DateAdd("n",{@Interval} * 3, {@MinDate})
AND{Table.DateField} <= DateAdd("n",{@Interval} * 4, {@MinDate}) THEN 4 ELSE
IF {Table.DateField} > DateAdd("n",{@Interval} * 4, {@MinDate})
AND {Table.DateField} <= DateAdd("n",{@Interval} * 5, {@MinDate}) THEN 5 ELSE
IF {Table.DateField} > DateAdd("n",{@Interval} * 5, {@MinDate})
AND {Table.DateField} <= DateAdd("n",{@Interval} * 6, {@MinDate}) THEN 6 ELSE
IF {Table.DateField} > DateAdd("n",{@Interval} * 6, {@MinDate})
AND {Table.DateField} <= DateAdd("n",{@Interval} * 7, {@MinDate}) THEN 7 ELSE
IF {Table.DateField} > DateAdd("n",{@Interval} * 7, {@MinDate})
AND{Table.DateField} <= DateAdd("n",{@Interval} * 8, {@MinDate}) THEN 8 ELSE
IF {Table.DateField} > DateAdd("n",{@Interval} * 8, {@MinDate})
AND {Table.DateField} <= DateAdd("n",{@Interval} * 9, {@MinDate}) THEN 9 ELSE
IF {Table.DateField} > DateAdd("n",{@Interval} * 9, {@MinDate})
AND {Table.DateField} <= {@MaxDate} THEN 10
This is where CR drops the ball... IMHO... it WON'T allow you to to group by a formula field that uses an aggregate in the formula (in this case Minimum & Maximum)... It will however allow to to graph on it, which I assume is what you are actually trying to do. If anyone knows a way to work around the grouping issue, I'd love to know it myself.
HTH,
Jason -
Divide any 12 months into group of 3 months
Hi,
I have a report where in my report fetches previous 12 months data. Previous means previous from current month. So if report is run in Feb-2014 it fetches data from Feb-2013 to Jan-2014.
Now, I need to divide this span of Months into group of 3 months. Like:
02/2013 - 04/2013
05/2013 - 07/2013
08/2013 - 10/2013
11/2013- 01/2014
How can it be achieved.. Any inputs please..
I am working on CR for Enterprise 4
Thanks..If the source wasn't a Universe, here's what you would do:
1) Find out of the Minimum Date from the records returned by the query. To do this, go to the Database Options on the Top > Show SQL Query > Copy. Let's assume the copied sql looks like this:
Select table.date, table.field1, table.field2 from Table where <condition>
2) Go to the Database Expert > Under the Connection Name, click Add Command > Paste the copied SQL and modify that to:
Select Min(table.date) as Minimum from Table where <condition>
2) Go to the Database Expert and make sure these two tables are Not Joined on any field
3) Create a formula with this code:
If Month({Date}) IN
[Month({Command.Minimum}),Month(DateAdd('m',1,{Command.Minimum})),
Month(DateAdd('m',2,{Command.Minimum}))] then 1
else If Month({Date}) IN [Month(DateAdd('m',3,{Command.Minimum})),Month(DateAdd('m',4,{Command.Minimum})),
Month(DateAdd('m',5,{Command.Minimum}))] then 2
else If Month({Date}) IN
[Month(DateAdd('m',6,{Command.Minimum})),Month(DateAdd('m',7,{Command.Minimum})),
Month(DateAdd('m',8,{Command.Minimum}))] then 3
else If Month({Date})
IN
[Month(DateAdd('m',9,{Command.Minimum})),Month(DateAdd('m',10,{Command.Minimum})),
Month(DateAdd('m',11,{Command.Minimum}))] then 4
Replace {Date} with the Date field from the existing table and {Command.Minimum} with the field from the Command Object that we added
4) Go to the Group Expert > Add this formula to the Group list.
That's it!
If you have access to the Universe, you can create a Dimension Object that gets Minimum Date from the query. You can then create another Dimension object using Case Statements that uses the 'Minimum' object to number each row as 1,2,3 or 4. You can then simply group on this new object inside the report.
Hope this helps.
-Abhilash -
How to find the number of records per months in cube
Hi,
how to find the number of records per months for my all cubes?
Can i use the ListCube transaction to find totl number f records per cube monthwise ?
JimmyHi,
Here is a program to generate no of records and list of ODS and Cubes in Active version.Schedule this program in background and create a cube to load this information and schedule to the data from the file generated by the program. Schedule this all per you requirement.
1.Copy the code into your Z<programname> from Se38.
2.change the FILENAME in CALL FUNCTION 'GUI_DOWNLOAD' in the program to the location from where you can pick the information to load data to cube(eg Application server).
3.Save program.
4.Schedule the program in background as required
5.Create cube with infoobjects to hold no of records and Infoprovider name
6.Load this cube based on event after the program job is done.
Hence you can report on this cube to see no of records in CUBE or ODS in your box.
Please find the code below.
Cheers,
Kavitha Kamesh.
types: begin of itabs ,
tabname type dd02l-tabname,
end of itabs.
data: itab type itabs occurs 0 with header line.
data: counter type i.
data: begin of itab1 occurs 0,
tabname type dd02l-tabname,
counter type i,
end of itab1.
DATA: ITABTABNAME TYPE STRING.
DATA: LENGTH TYPE I.
DATA: OBJECT(30).
data: str(6) type c.
select tabname from dd02l into table itab where ( tabname LIKE '/BIC/F%' or tabname LIKE '/BIC/A%00' )
and TABCLASS = 'TRANSP' and AS4LOCAL = 'A'.
loop at itab.
select count(*) from (itab-tabname) into counter.
str = itab-tabname.
if str = '/BIC/F'.
LENGTH = STRLEN( ITAB-TABNAME ).
SHIFT itab-tabname BY 6 PLACES LEFT.
ELSEIf str = '/BIC/A'.
SHIFT itab-tabname BY 6 PLACES LEFT.
LENGTH = STRLEN( ITAB-TABNAME ).
LENGTH = LENGTH - 2.
endif.
itab1-tabname = itab-tabname(LENGTH).
append itab1.
itab1-counter = counter.
clear itab-tabname.
clear: COUNTER.
endloop.
*********** itab1
loop at itab1.
write:/ itab1-tabname, itab1-counter.
endloop.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = 'c:records.xls'
FILETYPE = 'ASC'
* APPEND = ' '
WRITE_FIELD_SEPARATOR = ','
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = itab1
* FIELDNAMES =
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. -
How Journal Import groups records from GL_INTERFACE into Journal Headers
Hello,
Does anyone know how or using what criteria the Journal Import program groups records from the GL_INTERFACE into Journal Entries?
The R12 User Guide says that :
REFERENCE4 (Journal entry name): Enter a journal entry name for your journal entry.
Journal Import creates a default journal entry name using the following format:
(Category Name) (Currency) (Encumbrance Type ID, if applicable) (Currency
Conversion Rate, if applicable) (Currency Conversion Date, if applicable) (Originating
Balancing Segment Value), chopped to the first 100 characters. If the above results in
multiple journals in the same batch with the same name, then additional characters are
chopped off, and a 2, 3, 4, and so on, is added for the second, third, fourth, journals with
the same name.
Does it mean that for every unique combination of Category+Currency+CurrencyConversion Rate+Currency Conversion Date, a Journal Header would be created? I also found that although not mentioned in the user guide, if the Accounting Date within a group of records is different, the import program includes accounting date to the above criteria and tries to create separate Journal headers per Accounting Date.
Also, is there a way to override this ( Category+Currency+CurrencyConversion Rate+Currency Conversion Date) criteria?
Thanks,
Manishany suggessions on the above query?
Thanks & regards
Aboo -
How to group these values month by month ?
Hi,
I have a nice SQL statement which returns days by days, the values of a device.
WITH S1 AS
(SELECT DATE1,
ROUND(AVG(VALEUR),2) Debit
FROM EVV_E032
WHERE DATE1 BETWEEN TO_DATE('01012006000000', 'DDMMYYYYHH24MISS') AND TO_DATE('31122006235959', 'DDMMYYYYHH24MISS')
AND CLEF_VAR =
(SELECT CLEF_VAR FROM SITE_DEBIT_RIVIERE WHERE SITE = 'E032'
GROUP BY date1
SELECT NULL LINK ,
TO_CHAR(n, 'DD.MM'),
NVL(ROUND(AVG(Debit),2), 0) "Débit"
FROM
(SELECT TRUNC(TRUNC(to_date(2006,'YYYY'),'year'), 'DD')-1 + level n,
rownum jours
FROM dual CONNECT BY level<=366
) days
LEFT JOIN s1
ON days.n = TRUNC(date1,'DD')
GROUP BY n
ORDER BY nSample values :
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('10/02/2006 09:49:59','DD/MM/YYYY HH24:MI:SS') 1,63);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('21/02/2006 10:35:12','DD/MM/YYYY HH24:MI:SS') 1,68);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('21/02/2006 11:30:30','DD/MM/YYYY HH24:MI:SS') 0);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('23/02/2006 14:02:02','DD/MM/YYYY HH24:MI:SS') 0);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('23/02/2006 16:22:34','DD/MM/YYYY HH24:MI:SS') 0);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('30/04/2006 18:09:08','DD/MM/YYYY HH24:MI:SS') 1,72);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('20/05/2006 11:57:02','DD/MM/YYYY HH24:MI:SS') 1,72);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('07/06/2006 15:11:58','DD/MM/YYYY HH24:MI:SS') 1,79);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('08/06/2006 20:00:26','DD/MM/YYYY HH24:MI:SS') 1,82);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('19/06/2006 09:42:32','DD/MM/YYYY HH24:MI:SS') 1,72);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('20/06/2006 04:30:00','DD/MM/YYYY HH24:MI:SS') 1,82);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('20/06/2006 10:39:01','DD/MM/YYYY HH24:MI:SS') 1,72);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('24/06/2006 19:34:50','DD/MM/YYYY HH24:MI:SS') 1,82);
Insert into "EVV_E032" (DATE1,DEBIT) values (to_date('26/06/2006 14:37:26','DD/MM/YYYY HH24:MI:SS') 1,88);The output are values grouped day by day. I would like to group tehse values month by month, but could not figure how to do. Even though I am not a newbie newbie on SQL, this code is going far too much for me. I know some of you guys can handle this. I tried hard but coud not succeed. Could you help me ?
Regards, Christian.Difficult to work out (read: too much hassle) with your data and sql, as you haven't provided a set of info for all the tables provided, but hopefully this will give you an idea:
with my_tab as (select trunc(sysdate)+30 dt, 1 val from dual union all
select trunc(sysdate) dt, 2 val from dual union all
select trunc(sysdate) dt, 20 val from dual union all
select trunc(sysdate)+30 dt, 10 val from dual union all
select trunc(sysdate)+60 dt, 6 val from dual)
-- end of mockup of table "my_tab"; see SQL below...
select trunc(dt, 'mm') dt, sum(val)
from my_tab
group by trunc(dt, 'mm')
order by trunc(dt, 'mm');
DT SUM(VAL)
01-MAR-09 22
01-APR-09 11
01-MAY-09 6 -
Chart: amount (count) of records per month (and year). How?
I need to create a chart eventually. Can't get what formula to use. The data is:
1 | 15 Jan
2 | 20 Jan
25 | 14 Mar
26 | 16 Mar
28 | 20 Mar
The chart should show amount(count) of records per month(and year). So in this example:
Jan: 2
Mar: 3
Hm... totally lost. Any tips?To do this it would be best to add a column in which you isolate the month from the rest of the date information. Here's an example:
You may hide the Month-Isolated column if it impacts your presentation.
The Month-Isolated formula is: =IF(ISBLANK(B), "", (MONTH(B)))
The formula for the count in the Summary table is: =COUNTIF(Data Table :: $C, COLUMN())
Hope this gets you on your way.
Regards,
Jerry -
Want to get sum/avg first 90% records in each grouped record set.
Hi Gurus,
Need your help or example query which help me to achieve sum/avg first 90% records in each grouped record set. Let me show you the basic query and output and proposed output.
select Pid, Sum(SalesAmt) TotalSaleAmt, Avg(SalesAmt) AvgSaleAmt, count(*) NoOfSales from ProductSales group by Pid;
PID TotalSaleAmt AvgSaleAmt NoOfSales
1 12000 100 120
2 24000 50 480
Now I need for PID =1 TotalSaleAmt of first 90% of NoOfSale i.e.120(this is basically nuber of rows found in PrdocutSales Table).
I hope I am clear enough explain my requirement... I would appreciate if we have some Analytical function available..
Gurus Pls help me asap..
Thanks In adavance...
Srichan.Now I need for PID =1 TotalSaleAmt of first 90% of NoOfSale i.e.120(this is basically nuber of rows found in PrdocutSales Table).
first 90% should mean first 90% by some order, so in this case, which 108 rows (of the 120) do you want to take into consideration?
with
the_sample as
(select 1 the_pid,10 the_sale,1 the_order from dual union all
select 1 the_pid,20 the_sale,2 the_order from dual union all
select 1 the_pid,15 the_sale,3 the_order from dual union all
select 1 the_pid,12 the_sale,4 the_order from dual union all
select 1 the_pid,12 the_sale,5 the_order from dual union all
select 1 the_pid,13 the_sale,6 the_order from dual union all
select 1 the_pid,19 the_sale,7 the_order from dual union all
select 1 the_pid,11 the_sale,8 the_order from dual union all
select 1 the_pid,15 the_sale,9 the_order from dual union all
select 1 the_pid,12 the_sale,10 the_order from dual union all
select 2 the_pid,25 the_sale,1 the_order from dual union all
select 2 the_pid,22 the_sale,2 the_order from dual union all
select 2 the_pid,22 the_sale,3 the_order from dual union all
select 2 the_pid,23 the_sale,4 the_order from dual union all
select 2 the_pid,29 the_sale,5 the_order from dual union all
select 2 the_pid,21 the_sale,6 the_order from dual union all
select 2 the_pid,25 the_sale,7 the_order from dual union all
select 2 the_pid,22 the_sale,8 the_order from dual
select the_pid,the_sum,the_avg
from (select the_pid,
sum(the_sale) over (partition by the_pid order by the_order) the_sum,
round(avg(the_sale) over (partition by the_pid order by the_order),2) the_avg,
the_order,
floor((0.9 * max(the_order) over (partition by the_pid))) to_pick
from the_sample
where the_order = to_pickRegards
Etbin -
Dscl: unable to ad/delete/amend user/group records - eDSPermissionError
hello,
i am unable to add/delete/amend opendirectory user and group records. users are still connecting but when i try do any of the above if get the follow error within a dscl session:
create Users qawsed
<main> attribute status: eDSPermissionError
<dscl_cmd> DS Error: -14120 (eDSPermissionError)
on investigation i noticed the error in system.log indicating that /System/Library/LaunchDaemons/edu.mit.kadmind.plist was missing.
so my questions are:-
1 has anyone seen the above error condition when using dscl and
2 can anyone explain how edu.mit.kadmind.plist is created or post an example of this file
your assistance is appreciated
regards
johnPost Unix queries to the Unix forum under OS X Technologies and server queries to the server forums.
-
Filter records with month and date
Hi,
i have records as follows in the table.
custno trn_dt amount
1 01-jan-06 100
1 10-jan-06 200 --->
1 15-feb-06 300
2 15-dec-06 111
2 15-jan-06 222 --->
2 01-fen-06 333
If i specify the runtime parameter as JAN-06 the output of the report should be with 2 records indicated with arrows above.
the query should pick up the record with the highest date for a specific customer.
in the above example for customer "1" 10-jan-06 is highest date and for customer "2" 15-jan-06 is the highest date.
hope the requirement is clear.
thanks in advanceSELECT custno, trn_dt, amount
FROM TABLE
WHERE (custno,trn_dt) IN
(SELECT custno, MAX(trn_dt)
FROM TABLE
GROUP BY custno)
There are many examples on this in SQL and PL/SQL forum. -
Get date by group by per month basis...
Hello all,
I am trying to write a query where i want the count per month...so for example...the below query
select to_char(date, 'MM/DD/YYYY')
from test
where rownum < 10;
TO_CHAR(date
02/10/2009
02/10/2009
02/10/2009
02/10/2009
02/10/2009
05/31/2009
02/10/2009
so i want a count on the date, but want it per month basis....
select count(*), to_char(date, 'MM/DD/YYYY')
from test
where rownum < 10
group by to_char(date, 'MM/DD/YYYY');
so basically end results should be like below
count(*) date
10 Month1
12 Month2
13 Month3Hi,
You're GROUPing BY something that changes from day to day.
You need to GROUP BY something that only changes from month to month, like this:
SELECT COUNT (*)
, TO_CHAR (dt, 'MM/YYYY') -- DATE is not a good column name
FROM test
WHERE ROWNUM < 10
GROUP BY TO_CHAR (dt, 'MM/YYYY')
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
Explain, using specific examples where the query above is not doing what you want, how you get the correct results from the data you posted. -
Grouping records in an internal table
Dear all,
Pls follow the code and suggest me to get the specified format.
Consider that i have created a view to populate the reqd data and collect those in an internal table and do a calculation for one field and modify the internal table.
when i pass this internal table to the function reuse_alv_grid , it throws out a report. But if i need to group the records of the internal table based on three fields, can i do that , if so , how should i do that, if not what method shud i adopt to get the grouped listing in ALV.
kindly give your views.
Code goes here..........
select distinct edatu j_3akvgr6 mvgr4 matnr bismt vbeln auart bstkd bstkd_e ihrez_e
bstdk_e bstdk bezei vrvez brgew ntgew volum werks kwmeng j_3asize posnr
INTO CORRESPONDING FIELDS OF TABLE itabdelshd
from ZVDELISHED
where J_3AKVGR6 IN CUSTOMER AND AUART IN ORDTYP
AND BISMT IN STYLE AND MATNR in FGMtrl AND bstdk_e IN PLNDATE
AND J_3ASIZE IN GRIDVAL and werks in plant and mvgr4 in ppmon and
bstkd in cpono and vbeln in Sales.
LOOP AT itabdelshd INTO wadelshd.
select sum( wmeng ) as tqty into wasumqty-tqty
from vbep where edatu = wadelshd-edatu and vbeln = wadelshd-vbeln
and j_3asize = wadelshd-j_3asize.
select sum( lfimg ) as dqty into wasumqty-dqty
from lips where vbelv = wadelshd-vbeln and j_3asize = wadelshd-j_3asize
wadelshd-PLND_QTY = wasumqty-tqty - wasumqty-dqty.
wadelshd-PLND_QTY = wadelshd-wmeng - wadelshd-lfimg.
wadelshd-COLOR = wadelshd-j_3asize(4).
MODIFY itabdelshd FROM wadelshd.
ENDLOOP.
PERFORM build_fieldcatalog.
PERFORM build_layout.
PERFORM display_alv_report.Dear Jorge,
It is working out, But i need to do the sum for the grouped data, for instance , if the below data is grouped data seen in the alv,
sales ord | color line.Item| Ord.qty | Pld.Qty | Date "
| 0001000551 | 002V | 100 | 6,800.000 | 1,200.000 | 25.09.2006"
| 0001000551 | 002V | 100 | 6,800.000 | 2,500.000 | 25.09.2006"
| 0001000551 | 002V | 100 | 6,800.000 | 3,100.000 | 25.09.2006"
| 0001000551 | 003K | 200 | 3,200.000 | 700.000 | 25.09.2006"
| 0001000551 | 003K | 200 | 3,200.000 | 1,200.000 | 25.09.2006"
| 0001000551 | 003K | 200 | 3,200.000 | 1,300.000 | 25.09.2006"
and if want to sum the the planed qty based on the line.Item Grouping, meaning, can i get the report in the below form.
sales ord | color line.Item| Ord.qty | Pld.Qty | Date "
| 0001000551 | 002V | 100 | 6,800.000 | 6,800.000 | 25.09.2006"
| 0001000551 | 003K | 200 | 6,800.000 | 3,200.000 | 25.09.2006"
what should i do to get this form.
Maybe you are looking for
-
i tried to upgrade my iphone 4 to ios5 yesterday in the installation process my iphone stopped process and the actuall phone itself has frozen what is showing is the music note icon over a CD disc icon with an arrow pointing upwards and a picture
-
FormToEmail.php - My email works, my clients doesn't!
Hi All! I've created a form for a client's site, as was working great. The email (when you hit submit) I put in my email, so I could test it and make sure it came through clear and easy to read. Worked perfect! So I add the clients email in there, wh
-
Third Party Sale - Cancellation of order
Scenario: Third Party Sale A- The company B- Customer C - Vendor The company A places sales order for particular material to Customer B. Company A is not able to produce the same. They pass on the order to Vendor C for processing. After processin
-
Hi, I have registered an invoice (with an asset) in MM with T-code MIRO, after that I canceled it with T-code MR8M. After cancellation an amount of 0,01EURO remain, which is posted only on depreciation area 05 (the other depreciation areas 15,20, 21,
-
ESS - JCO Connection and Performance
Hi Forum, In ESS Package Applications we are not using Applications related to Travel Management and Finance but JCO connections are created for the respective application namely 1. SAP_R3_Travel & SAP_R3_Travel_MetaData 2. SAP_R3_Financials & SAP_R3