Count of Data of column
Hi
one questions
from DB i did RSUM,% etc etc and got data in the below format
Category | Customer| Sales
1 | ABC| 93
2 | DEF| 83
3 | GHI | 73
4 | JKL | 64
4 | MNO| 63
5 | QRS | 55
5 | TUV | 54
Now I need to show report in below format
Category |No of Customers| Sales| Avg Sales
1 | 1| 93| 93
2 | 1| 83 | 83
3 | 1| 73 | 73
4 | 2| 127| 63.5
5 | 2| 109| 54.5
Can anybody help get this No of Customers and Sales total for a category pls
Thanks in Advance
Cheers
Edited by: user511637 on Jul 22, 2009 10:11 AM
Edited by: user511637 on Jul 22, 2009 10:15 AM
Hi,
Try this way
category|count( customer by category)|sum(sales by category)|sum(sales by category)/count(customer by category)
Hope it helps you
Similar Messages
-
How to Group Data from column?
Hi All,
Can any one solve my problem please?
I have Two Column "Age" and "Employee ID".
I want to Group "Number of Employees" for specific AGE range Like:
Age | Number of Employees
20 to 30 | 06
31 to 40 | 13
41 to 50 | 16
51 to 60 | 03
And data in Columns are fallowing
Age | Employees ID
30 | 002
38 | 008
33 | 298
22 | 213
54 | 083
24 | 098
So on.
Waiting for your HELP.
In advance Thank you very much...
Take careHere you go..
Drag any column in Answers and name it as Age and in its fx write
case
when tablename.age between 20 and 30 then '20 to 30'
when tablename.age between 31 and 40 then '31 to 40'
when tablename.age between 41 and 50 then '41 to 50'
when tablename.age between 51 and 60 then '51 to 60'
end
Drag any column in Answers and name it as "Number of Employees" and in its fx write
Count(tablename.EmployeeID)
This would give you the desired Report
Hope its helpful...
Thanks
Ashish Gupta -
I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.
Hello. Most of the engineers in developer exchange are more familiar
with NI products. Contacting ICS for technical support is a better
course of action. -
How to export data with column headers in sql server 2008 with bcp command?
Hi all,
I want know "how to export data with column headers in sql server 2008 with bcp command", I know how to import data with import and export wizard. when i
am trying to import data with bcp command data has been copied but column names are not came.
I am using the below query:-
EXEC master..xp_cmdshell
'BCP "SELECT * FROM [tempdb].[dbo].[VBAS_ErrorLog] " QUERYOUT "D:\Temp\SQLServer.log" -c -t , -T -S SERVER-A'
Thanks,
SAAD.Hi All,
I have done as per your suggestion but here i have face the below problem, in print statment it give correct query, in EXEC ( EXEC master..xp_cmdshell @BCPCMD) it was displayed error message like below
DECLARE @BCPCMD
nvarchar(4000)
DECLARE @BCPCMD1
nvarchar(4000)
DECLARE @BCPCMD2
nvarchar(4000)
DECLARE @SQLEXPRESS
varchar(50)
DECLARE @filepath
nvarchar(150),@SQLServer
varchar(50)
SET @filepath
= N'"D:\Temp\LDH_SQLErrorlog_'+CAST(YEAR(GETDATE())
as varchar(4))
+RIGHT('00'+CAST(MONTH(GETDATE())
as varchar(2)),2)
+RIGHT('00'+CAST(DAY(GETDATE())
as varchar(2)),2)+'.log" '
Set @SQLServer
=(SELECT
@@SERVERNAME)
SELECT @BCPCMD1
= '''BCP "SELECT
* FROM [tempdb].[dbo].[wErrorLog] " QUERYOUT '
SELECT @BCPCMD2
= '-c -t , -T -S '
+ @SQLServer +
SET @BCPCMD
= @BCPCMD1+ @filepath
+ @BCPCMD2
Print @BCPCMD
-- Print out below
'BCP "SELECT
* FROM [tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername'
EXEC
master..xp_cmdshell
@BCPCMD
''BCP' is not recognized as an internal or external command,
operable program or batch file.
NULL
if i copy the print ourt put like below and excecute the CMD it was working fine, could you please suggest me what is the problem in above query.
EXEC
master..xp_cmdshell
'BCP "SELECT * FROM
[tempdb].[dbo].[wErrorLog] " QUERYOUT "D:\Temp\LDH_SQLErrorlog_20130313.log" -c -t , -T -S servername '
Thanks, SAAD. -
iam not able to insert data into datagrid corresponding to the column names..as iam inserting both data and column names programatically..ie iam not able to co relate the data with the column names.plzzz help me asap
A DataGrid is row-based rather than cell-based with each row
corresponding to an item in an underlying collection (specified in the
dataProvider property). In order to add data to a DataGrid you
manipulate the underlying collection, rather than the grid directly.
Based on the limited description of your problem I would imagine you
would need to create dynamic objects with property names that correspond
to the dataFields of your dynamically created datagrid columns.
So if you had created columns with dataFields "alpha", "beta" and
"gamma" on your datagrid, you could create an item in your grid by
adding the following object to your dataProvider:
var gridItem : Object = new Object();
gridItem.alpha = "alphaValue";
gridItem.beta = "betaValue";
gridItem.gamma = "gammaValue"; -
Got a new Mac, my iTunes is whack, (No Play Count or Date Added)
Hello, everybody. It's been a rough night.
I currently own a G4 iMac and I just got a brand new Macbook. The Macbook is very nice, it's extremely speedy and I am sure I will grow to love it. We've got just one hurdle to get through together: the organization of my music in iTunes. Now, I've had the iMac for five years, and not long after I got it adding music to it became something of an importance, it was my music player. Over the past five years I've not only added thousands of songs, but meticulously and very specifically organized them into playlists based on the number of spins they have and when they were added. To a lot of people I know this sort of thing isn't a huge deal, but for me this organization became, and I kid you not, a huge, huge part of my life.
So I get the new Macbook, fire it up and use Migration Assistant, (with the iMac in Target Disk Mode), to move my data over. When it's done I open the iTunes and am greeted with... nothing. Well, okay, all of my music is there, that's nice, (it's what iTunes is for, etc etc), but NONE of my play count or date added information remains. I weep inside.
Being that this is my first new computer in five years, (a long time!), you might be able to tell that I was hesitant about upgrading. Before getting my Macbook I asked experts at the Apple Store if this method would work, and even received assurance from several people online that everything would be preserved. So, I did my homework, but my Macs and I both apparently failed the test. Here's where we are now:
1. The iMac, (running Tiger), still has iTunes on it, with all the information, nothing seems to have changed on that end.
2. The Macbook has a hard drive full of music with no playlist, play count or date added data.
3. I do own an iPod where I backed up the music before the move. I know that the data information on playlists, play count and date added is on the iPod. I do not dare plug it in to the new machine for fear of the unknown.
Which brings me here, is there some way, any way of rectifying this? Here is what I would like:
1. For the Macbook iTunes to look EXACTLY like the iMac's does.
2. For it to work with both my old iPods without question.
This has been long, and I fear that some may pass it over as something too much of an banality to be needed help with. But like some collect shoes or hats, I collect music. It's a lovely collection and it's a large part of who I am. I could start all over, but that's sort of like saying the world could start over if it by chance happened to forget how to turn. It would take a lot of effort, and there would be some (more) tears, but I could move on. But I really, really don't want to. I just want things to be the way they were. I'd very much like to have this information present, and I thank you all for your time.ADDED:
Now that I look at it, appears that nothing except for my applications transferred over. My old computer is listed in the Hard Drive, but I can't access any of the folders because I don't have that "level of privileges" or whatever, (odd, considering they're both my computers, do they need to be hooked up for this?). I don't really need for my old applications to be there, (Hello, iWork '06 Demo!), so can I just go and erase them, or am I better just starting all over again? -
Want to display a date in column heading.
Hi all,
Will be thankful, if anyone can tell me how to solve one of the issue i am facing in webi variable display.
In universe, i am creating one prompt for date and user will enter the desired date, and with respect to that date, the previous date and previous month last working date will come. In my Webi report , i have 3 dates and one measure(Quantity) with other dimensions like Product and Subproduct.
I have one cross table in which in want to show the 3 dates as Column heading, Product as row heading and Quantity(measure) in the table body. I have one more dimension as Area... which i want to show in horizontal way, for each Area, i want to show prompted date, previous date and previous month last date. I have created 3 variables....
1. Current date = Max(date) In Report
2. Previous date = Min(date) In Report
3. Previous Month last day = (date) where (Rank = 2) ForEach(date)
By this way, I am able to show Current date and Previous Month last day in column heading, but not Previous day. Will appreciate if anyone can help me on the issue. let me know if any other information is required.
Thanks
Archit SarwalHi,
The previous date is the previous business day, it can be dynamic. And previous month's last day is last business day, it can also be dynamic. And Previous daye can also be previous month's last business day in one of the scenerio.
Actually i am using 3 filters with prompts (common prompt) in universe side. User will enter the date and corrosponding previous business day and previous month's last business day will come. 3 filters are:
1. Current_Day = @prompt('Enter Date(YYYYMMDD)','A',,Mono,Free,Persistent)
2. Previous_Day = (SELECT TOP 1 Date from [TableName] where Date < @prompt('Enter Date(YYYYMMDD)','A',,Mono,Free,Persistent) Order By Date Desc)
3. Prior_Month last Day = (SELECT TOP 1 Date from [TableName] T where Month(T.Date) = Month(DateAdd(mm,-1,@prompt('Enter Date(YYYYMMDD)','A',,Mono,Free,Persistent))) Order By T.Date Desc)
Dates are coming correct from Universe. In Webi, i have created variables...
CurrentDate = max([Date]) In Report
LastDate = Min([Date]) In Report
PriorDate = [(Date]) where ([Rank]=2) ForEach ([Date])
I have calculated Rank for Date, and Rank 2 shows the Prior Date. Also, i have Entity, and want to show these dates for each entity along with 2 -3 more columns that depends on these 3 dates values. I am attaching the screenshot for the sample.
Thanks
Archit Sarwal -
Moving a table with long data type column
hi
1.how to move a table with a long data type column in 8.1.7.3.0 ver database.
alter table APPLSYS.FND_LOBS_DOCUMENT move lob(BLOB_CONTENT) store as (tablespace testing)
ERROR at line 1:
ORA-00997: illegal use of LONG datatype
2. and a table with varray type column
alter table APPLSYS.WF_ERROR move lob("USER_DATA"."PARAMETER_LIST") store as (tablespace testing)
ERROR at line 1:
ORA-22917: use VARRAY to define the storage clause for this column or attribute
table description is:
SQL> desc applsys.wf_error;
Name Null? Type
Q_NAME VARCHAR2(30)
MSGID NOT NULL RAW(16)
CORRID VARCHAR2(128)
PRIORITY NUMBER
STATE NUMBER
DELAY DATE
EXPIRATION NUMBER
TIME_MANAGER_INFO DATE
LOCAL_ORDER_NO NUMBER
CHAIN_NO NUMBER
CSCN NUMBER
DSCN NUMBER
ENQ_TIME DATE
ENQ_UID NUMBER
ENQ_TID VARCHAR2(30)
DEQ_TIME DATE
DEQ_UID NUMBER
DEQ_TID VARCHAR2(30)
RETRY_COUNT NUMBER
EXCEPTION_QSCHEMA VARCHAR2(30)
EXCEPTION_QUEUE VARCHAR2(30)
STEP_NO NUMBER
RECIPIENT_KEY NUMBER
DEQUEUE_MSGID RAW(16)
SENDER_NAME VARCHAR2(30)
SENDER_ADDRESS VARCHAR2(1024)
SENDER_PROTOCOL NUMBER
USER_DATA APPS.WF_EVENT_T
lob column:
SQL> select owner,table_name,column_name from dba_lobs where table_name='WF_ERROR';
OWNER TABLE_NAME COLUMN_NAME
APPLSYS WF_ERROR "USER_DATA"."PARAMETER_LIST"
APPLSYS WF_ERROR "USER_DATA"."EVENT_DATA"
pls help me
thanks and regards
srinivas1. Export and import
2. Sql*Plus 'copy' command
It is a good idea to move from 'LONG' to 'CLOB'. -
Issue with using formatted date value column in order by clause...
Hi,
1) Through a function I am listing all the months in a year.
like JAN-2007, FEB-2007,MAR-2007......
2) i am comparing these values against a date value column in a table.
And if there are no values in a particular period it will return a null value (simply to say, i am using an outer join)
3) The issue.....
When join both the queries then the order of the dates is not mainted .....
My requirement is......
Jan-2007 = 3
Feb-2007 = 5
Mar-2007 = null
etc.....
should be acheived.
But I end up in the alphabetical order of the months....
like
Apr-2007 = 5
Aug-2007 = 10
etc.....
Can anybody let me know how can i acheive my resultant output to be ordered by the date and not by character.
When I use the date column in the order by I run into an error....
saying....
ORA-01858: a non-numeric character was found where a numeric was expected
Its a kind of urgent...
Any help is appreciated....
KKWhen I use a outer join as follows....
"and upper(to_char(a.task_planned_start_date,'mon-rrrr')) = d.period_name(+)"
All the null periods are ending at the bottom.It's standard behavoiur.
Seems, you need to sort by a.task_planned_start_date.
Look below:
SQL> select e.ename, ec.ename from emp e, emp_copy ec
2 where e.empno = ec.empno(+);
ENAME ENAME
SMITH SMITH
ALLEN
WARD WARD
JONES
MARTIN MARTIN
BLAKE
CLARK CLARK
SCOTT
KING KING
TURNER
ADAMS ADAMS
JAMES
FORD FORD
MILLER
14 rows selected.
SQL> select e.ename, ec.ename from emp e, emp_copy ec
2 where e.empno = ec.empno(+)
3 order by ec.ename
4 /
ENAME ENAME
ADAMS ADAMS
CLARK CLARK
FORD FORD
KING KING
MARTIN MARTIN
SMITH SMITH
WARD WARD
JAMES
TURNER
ALLEN
MILLER
BLAKE
JONES
SCOTT
14 rows selected.
SQL> select e.ename, ec.ename from emp e, emp_copy ec
2 where e.empno = ec.empno(+)
3 order by e.ename
4 /
ENAME ENAME
ADAMS ADAMS
ALLEN
BLAKE
CLARK CLARK
FORD FORD
JAMES
JONES
KING KING
MARTIN MARTIN
MILLER
SCOTT
SMITH SMITH
TURNER
WARD WARD
14 rows selected.Rgds. -
How to COUNT all data Characters in an IDOC ?
Hi All,
I am doing an IDOC-->File scenario.
As per the Third party system requirements, I need to COUNT all the Data characters (Minus the EDIDC record) and write this value at the end of the trailer record in the file.
Example:
EDIDC--> SAPR3, LS...
E1KNA1M-->SHIRIN, UK, SW1DPL
E1KNBKM-->SHIRIN, CITIBANK
So in this example I should sum up(COUNT) all the characters(of Data) belonging to segment E1KNA1m and E1KNBKM. So here COUNT is '28'. So I need to write the value '28' at the end of the file.
I want to know, is it possible to count data in XI mapping or should this be done in R/3 itself and appended as a COUNT field to the IDOC.
Appreciate any suggestion help on this. All I want to know which is the best practise/place to count the data characters in this scenario.
Thanks
ShirinHi,
Thanks for explaining.Really appreciated.
Just to confirm,
in Java edit Section I have added the following data: Please let me know if that is correct.
Imports:
Global Variables: len
Initilisation section: 0
Clean-up:
Similarly in UDF I have entered the following data:
Label/Description: Calculate length
Cache: Value(radiobutton)
Arguments: a
Next screen:
Imports:
public String Calculate(String a, Container container)
Then entered ur code.
When I save and activate I get the following error
Starting compilation Source code has syntax error: D:/usr/sap/XRD/DVEBMGS02/j2ee/cluster/server0/./temp/classpath_resolver/Map2494b0c0596b11dda115001a4b52813a/source/com/sap/xi/tf/_MM_ALLOCATION_RESPONSE_.java:32: <identifier> expected public /*!_$ClNRep_*/_MM_ALLOCATION_RESPONSE_(){} ^ D:/usr/sap/XRD/DVEBMGS02/j2ee/cluster/server0/./temp/classpath_resolver/Map2494b0c0596b11dda115001a4b52813a/source/com/sap/xi/tf/_MM_ALLOCATION_RESPONSE_.java:210: ';' expected } ^ 2 errors
Appreciate if you could help.
Thanks
Shirin -
Distinct count on date/time field...
Hi,
I am trying to a distinct count on this formula that takes a date/time field and converts it to a date in order to get a distinct count of dates. However, it's not working... say, if I have two dates are the same (the times may be different), it's counted twice. Any suggestions? I tried to convert this to a string thinking the evaluation may change, but no dice. Thanks!!
if not isnull({AVAILABILITY.PAT_ENC_CSN_ID}) then
cstr(cdate({AVAILABILITY.SLOT_BEGIN_TIME}))
elseYou can use the following formula...
DateAdd("d", DateDiff("d", #1/1/1900#, {TableName.YourDateTimeField}), #1/1/1900#)
This will set each date value to 12:00 am of it's respective day...
So 8/16/2010 3:01:20PM would become 8/16/2010 12:00:00AM
Now you can group on this formula field and then simply do a count on the date at the appropriate group level.
HTH,
Jason -
How to use selectOneList in a updateable data table column
Hi,
Could someone tell me how to use selectOneList (source from a vo X) in an updateable data table column (from another vo Y)?
I successfully created a page with the data table. However, strange things happened:
1) the values populated on the selectOneList column don't match the underlying value in vo Y. in fact, every rows in the column got the same value.
2) when I update one of the rows, the column value in every other rows turns to the new value.
3) when I sort other columns in the table, the values shown in the selectOneList column get toggled between blank and some incorrect value.
I believe it is something related to the fact that the same iterator is used to the source view object. If this is the case, how can I solve it?See #7 here:
http://radio.weblogs.com/0118231/stories/2005/06/24/jdeveloperAdfScreencasts.html -
How to get data with out having any date/timestamp columns by year wise
hi,
how can i select years wise rows from tables,if that have not any date/timestamp column.Well Govind it quite depends on what is the data type of that column and the format in which it is stored.
If the data type is varchar2/varchar and all the values are in a uniform format then there is no problem. All you need to use is the to_date function to convert the supplied strings to default date format and then use to_char function to only extract the YY or YYYY or RR or RRRR aspect of the data.
For example: If the column is called 'hire_date' and it's data type is varchar2 and the entries in this column are all in a uniform format, say month,date,year like January,12,1999. What you need to do is convert this string to a default date value using to_date function, like to_date(hire_date,'format_model') In the format model mention the format of the hire_date string. The out put of this function can be fed into to_char to extract the year, like to_char(output_of_to_date,'YYYY')
I hope you got what I meant. Let me know if it was of any use. -
How to use Count with Date Parameters
Hello,
I am having issues using the Count() function in conjunction with date parameters.
This is a Siebel report and in my report I have 2 date parameters(From Date, To Date). In a nutshell I am basically trying to count Opportunities that has a start date within the given date period. However I don't see a reasonable way to put my date parameters within the Count() function. The reason being is that I need to have a huge chunk of code to convert the dates into a common format that can be compared, and it won't even fit within the code block in my rtf template. I am not even sure how to put multiple conditional statements inside a Count() function since all the examples I have seen are very simple.
Anyone have a suggestion on how to use Count() with date parameters?
Thanks.Any chance you can get the date formats in the correct format from siebel?
I don't know Siebel - so I can't help you with that. If you get the correct format it is just
<?count(row[(FromDate>=date) and (date<=ToDate))?>
Otherwise the approach would probably need to use string function to get year/monthd/day from the date
and store it into a varialbe and compare later the same way
<?variable@incontext:from; ....?>
<?variable@incontext:to; ...?>
<?count(row[($from>=date) and (date<=$to))?>
Potentially you can use the date functions such as xdofx:to_date to do the conversion
[http://download.oracle.com/docs/cd/E12844_01/doc/bip.1013/e12187/T421739T481158.htm]
But I am not sure if they are available in your siebel implementation.
Hope that helps -
How to compare the date value with the date datatype column?
Hi,
I am executed a query to get output for the particular date in two different database.
I got output in one db environment, but in the another environment i didnt get the output.
APP_DECISION_DATE column contains date datatype
ex:
SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE = TO_DATE('23-JAN-07',
'DD-MON-YY'); 2
DECISIONED_STAGE_ID DECISIONED_STAG
2006060106 SYSTEM
DATABASE - II
SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE=
TO_DATE('31-JAN-2007','DD-MON-RRRR') and application_id=2007010028552;
no rows selected
in the same db i got the output while i used the TO_DATE(APP_DECISION_DATE)
SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where TO_DATE(APP_DECISION_DATE)=
TO_DATE('31-JAN-2007','DD-MON-YYYY') and application_id=2007010028552; 2
DECISIONED_STAGE_ID DECISIONED_STAG
2006060113 SYSTEM
is it necessary to use TO_DATE function while i am using the data datatype column in the WHERE CLAUSE?
Thanks in advance.
sivaSorry & thanks sathish,
Now i got the result.
SQL> select DECISIONED_STAGE_ID,DECISIONED_STAGE_USER_ID from naap10_application where APP_DECISION_DATE BETWEEN TO_DATE ('31.01.2007 00:00:00', 'DD.MM.YYYY HH24:MI:SS') AND TO_DATE ('31.01.2007 23:59:59', 'DD.MM.YYYY HH24:MI:SS')
2 and application_id=2007010028552;
DECISIONED_STAGE_ID DECISIONED_STAG
2006060113 SYSTEM
================================
But one doubt,
When i created the column with the date datatype how it gets the time value,
And in one environment db i got the result but in another environment i dont get,
Shall i want to change any session status of date?
Maybe you are looking for
-
How to make things other than text hyperlinks
I was looking to make a group of pictures link to some bookmarks but have so far failed. While making a simple box then filling the background with an image, then filling the box with space characters and then selecting the spaces to link to a bookma
-
Data Modeler EA1 - Print settings not saved
Is there any way of saving page/print settings? Getting print settings/layout right often takes several changes in setup, at the moment it appears to make me do it every time I print.
-
PR line item deletion upon PM order TECO
Hi All, PR line item gets deleted upon PM order TECO. Any suggestions pls. Thanks in advance.
-
Invalid field format (screen error)
We are using custom module pool report for displaying information. Information display in Table control which has also Radio button option for the further processing. After unicode conversion we are getting error while accessing the screen as "Invali
-
Bug regex parser since 15.0.0.223
Hi, I have a major issue on the version 15.0.0.223 I have the following regex : /\${((?>[^${}]*)(?:(?>[^${}]+|(?R)))*(?>[^${}]*))}/ I use it in a Parameter resolver to match the first encountered ${...} on strings like: "${serverBaseURL}/${appName}"