Cross tab: Getting the count based on three consecutive dates
Hi All,
I have a crosstab which as Ticket_no and Date columns. here is the sample report data.
Ticket_no Date
1 1-Jan-2013
1 2-Jan-2013
1 3-Jan-2013
2 1-Jan-2013
1 1-Jan-2013
count of tickets which are raised for consecutive 3 days in a month. Here ticket_No 1 is raised for the first 3 days..so count will be 1.
Can any one help me in this case.
Thanks in advance.
Regards,
Krishna
Krishna, Bring Ticket_No as Dimension from universe,
In web I, create a variable
= Count([Ticket_No])
Similar Messages
-
Need to get the count based on the column availability
You get a set of table names from a query, say
select table_name from all_tab_columns where column_name like 'DC_I’;
TABLE_NAME
A
B
C
Now, for the above set of tables (A,B and C), you need to get the count(*) for a single dc_i value (say XXX DC)
In simple words, its like framing the following 4 separate queries into one single one:
select table_name from all_tab_columns where column_name like 'DC_I’; (Based on this o/p, following 3 queries..)
select count(*) from A where dc_i=XXX;
select count(*) from B where dc_i=XXX;
select count(*) from C where dc_i=XXX;
ThanksAre you looking for this?
satyaki>
satyaki>select * from v$version;
BANNER
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
Elapsed: 00:00:01.04
satyaki>
satyaki>
satyaki>
satyaki>SELECT table_name,
2 DBMS_XMLGEN.getxmltype ('SELECT Count(*) c FROM ' || table_name||' where '||column_name|
|' = 10').EXTRACT ('//text()').getnumberval() tot_rows
3 FROM all_tab_cols
4 WHERE table_name in ('EMP', 'DEPT')
5 and column_name = 'DEPTNO';
TABLE_NAME TOT_ROWS
EMP 4
DEPT 1
Elapsed: 00:00:01.00
satyaki>
satyaki>
satyaki>
satyaki>select count(*) from emp where deptno = 10;
COUNT(*)
4
Elapsed: 00:00:00.00
satyaki>
satyaki>
satyaki>select count(*) from dept where deptno = 10;
COUNT(*)
1
Elapsed: 00:00:00.00
satyaki>Regards.
Satyaki De. -
How to display a row in Cross Tab when the count summary is zero
My customer wants a row for all possible data, even when the count is zero. How can I get a row to display when there is no data? Using an example: Display status for incidents - possible five statuses, but selection only results in four statuses because no incident were cancelled. Customer wants all five statuses to display in cross tab with cancelled showing '0' (zero))
Open
WIP
Cancelled
Pending
ClosedThis worked for the last guy who had a similar issue.
Take a look at what it's doing. You should be able to use the same principal to meet your needs...
I'm assuming that you'll only need to show 4 weeks at a time on your report.
The easiest way to do it is by creating 8 separate formula fields:
W1A
W1RT
W2A
W2RT
... and so on
I don't know how your data is coming across but the formula should go something loke this:
W1A... IF datepart(ww,currentdate) - datepart(ww,) =0 THEN
W1RT... IF datepart(ww,currentdate) - datepart(ww,) =0 THEN
W2A... IF datepart(ww,currentdate) - datepart(ww,) =1 THEN
W2RT... IF datepart(ww,currentdate) - datepart(ww,) =1 THEN
... and so on
If I got you weekly criteria wrong, sorry. It's just a best guess.
Anyway you should be able get the idea. It gives you the effect of a crosstab without the headaches of a crosstab.
Hope this works for you,
Jason
Edited by: Jason Long on Jun 28, 2008 3:19 AM -
Steps to create the counter based Maintenance plan
Hi!
Can any body give "Steps to create the counter based Maintenance plan"
(Mater Data,Transactional Data and Customizing Data creation)
Regards,
MDSFRhi
please refer the following link
http://help.sap.com/saphelp_46c/helpdata/en/fe/67ef189d6f11d189b60000e829fbbd/content.htm
regards
thyagarajan -
SQ01 - SAP List Viewer - Ability to get the count of the output records
Hello All,
I have a problem with the SAP List Viewer output for an SAP Query.
I have created a SAP query (SQ01) for a table. Its a basic query that queries on just one table (VTBFHA)
When I run the query, for the output in the SAP List Viewer (ALV) format, Could anyone kindly help me figure out how to get the count of the number of records displayed in the output?
For Eg: when we run the T code SE16, It gives us the number of records displayed in the output.
Similarly, does anyone know if there is a way I could display the count of the number of records displayed in the output of the SQ01 query?
I have tried checking the "Counter" in the basic list tab, but it does not give me the count.
Any help will be greatly appreciated
Thanks
SubhaniYes there is a solution. Follow these steps
Select your query
Hit the button InfoSet Query
Go to Edit->Settings->
Check the box "Count in the Output list" in the Output tab
Hit Save
In pop up box select the user group
hit enter
Hit the back arrow (F3)
now Execute the query
You should be able to see the count in the output.
The count will appear on the right most column of the output. If it does not go to the "Change layout" option and make sure it is part of the "Displayed columns list".
Regards -
Get the count of number of people reporting to Manager directly/indirectly
I have the following Manager / Employee hierarchy.
Manager -> employee
A -> B (B is reporting to A)
A -> B -> C (C is reporting to B and B is reporting to A)
A -> B -> C -> D(D is reporting to C and C is reporting to B and B is reporting to A)
How can the get the count of total no of person reporting to A either directly or indirectly.
My count should be like that.
A -> B (count - 1)
A -> B -> C (count - 2)
A -> B -> C -> D (count - 3)
appreciate any inputs..Hi
You need to run something like:
SELECT ENAME "Employee", CONNECT_BY_ROOT ENAME "Manager",
LEVEL-1 "Pathlen", SYS_CONNECT_BY_PATH(ENAME, '/') "Path"
FROM EMP
WHERE LEVEL > 1
CONNECT BY PRIOR MGR = EMPNO
this is based on the EMP table and connects every employee to their top-level manager
Andy -
How can i get the count vaule from GPIB?
I want to get the count waule from GPIB ,but I find that the vaule I get from GPIB now is the trace vaule ,
so I ask How can i get it.The count of what? What kind of instrument are you using?
-
To get the count of records and able to access the column value in a single
Hi
Is there any way to get the number of records in the query and access the column values
e.g
select count(*)
from
(SELECT department, COUNT(*) as "Number of employees"
FROM employees
WHERE salary > 25000
GROUP BY department ) a
This wil only get the Count, if i want to access each row from the inline view how can i do that.Your question is not clear.
Are you looking for total record count as well as count by department ?
Something like this?
SQL>
SQL> with temp as
2 (
3 select 1 dept ,10000 sal from dual union
4 select 1 dept ,25100 sal from dual union
5 select 1 dept ,30000 sal from dual union
6 select 1 dept ,40000 sal from dual union
7 select 2 dept ,10000 sal from dual union
8 select 2 dept ,25100 sal from dual union
9 select 2 dept ,30000 sal from dual union
10 select 2 dept ,40000 sal from dual )
11 select count(*) over( partition by 1 ) total_count,dept,
12 count(*) over(partition by dept) dept_cnt from temp
13 where sal>25000;
TOTAL_COUNT DEPT DEPT_CNT
6 1 3
6 1 3
6 1 3
6 2 3
6 2 3
6 2 3
6 rows selected
SQL> -
I'm trying to get the count for each row to total count for each month
Something like this
Hardware | Jan
Monitors | 5
Processors | 137
Printers | 57
etc........
How can I write a query for this. I can get the Hardware column but don't know how to get the next column.If you can provide more data like sample input DML statements it would have been wonderful..
Assuming is , you need a pivot. Here is an article on basic Pivot..
http://sqlsaga.com/sql-server/how-to-use-pivot-to-transform-rows-into-columns-in-sql-server/
something like this may be..
DECLARE @Input TABLE
Hardware VARCHAR(20),
[Date] VARCHAR(20)
INSERT INTO @Input VALUES('Monitor', '01/01/2014'), ('CPU', '01/01/2014'), ('Monitor', '01/03/2014')
, ('ABC', '01/01/2014'),('Monitor', '02/01/2014')
;WITH CTE AS
SELECT Hardware, LEFT(DATENAME(M, [Date]),3) AS [MonthName] FROM @Input
SELECT *
FROM
SELECT Hardware, [MonthName], COUNT(Hardware) AS Count FROM CTE GROUP BY Hardware, [MonthName]) a
PIVOT (MAX([Count]) FOR [MonthName] IN ([Jan], [Feb])) pvt
Please mark as answer, if this has helped you solve the issue.
Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles. -
Get the count of rows in a table control
Hi Experts,
How do I get the count of the rows in a table control during run time.
I am developing a BDC in which I have to check all entries in a table control.
My requirement is to get the total number of rows in a table control dynamically.
Thanks
KumarHi,
Use a variable when u r passing the records from the internal table to the screen fields
and display the same.
I think this idea may help u.
And pls explain me ur requirement clearly.
Refer to the following link this may help u.
http://sapabapnotes.blogspot.com/2008/03/working-with-ecatt-extended-computer.html
Reward if helpful.
Jagadish -
Select Count(*) from Sample_table - how to get the count using JDBC?
Hi All,
It would be glad if anyone could help me with this. The problem is that I have to get the 'count' of records selected from a arbitrary table say, 'sample_table'. Is that possible to form the SQL in JDBC as
Select Count(*) from Sample_table
and get the value of the count? If yes, how?
Thanks in advance
Prabzstmt = con.createStatement();
ResultSet recordcnt_rs = stmt.executeQuery("Select Count (*) as record_ctr From Sample_table");
recordcnt_rs.next();
record_ctr = recordcnt_rs.getInt("record_ctr");
hope this helps. -
I always get the count as 0 for the variable. I am not sure what I am doing wrong. Please let me know if any of you know the fix.
ThanksHere is the query I used now. Still same result
SELECT (select count(*) from usr_all_mbrs where PREMIER_YN = 'Y') AS count1
SELECT
(select
count(*)
from usr_all_mbrs
where PREMIER_YN
=
'Y')
AS count1 -
EXPECTED OUTPUT: here i need to get the count of 932 + 134 records = 1064
Hi Team,
could you pls suggest y iam getting wrong count.
select * from i_invoice_info_t_log_v invlog,invoice_header_t invhead
WHERE substr(invlog.tot_cust_no,1,7)=substr(invhead.acct_no,3,7)--------comparing tot_cust_no and acct_no for the other countries
and invhead.comp_code NOT in (2300) ----here when iam running this query i am getting the count of 932 records.
select * from i_invoice_info_t_log_v invlog,invoice_header_t invhead
where substr(invlog.tot_cust_no,3,7)=to_char(substr(invhead.acct_no,3,7))--------------comparing tot_cust_no and acct_no FOR THE COUNTRY 2300
and invhead.comp_code in (2300) ----Here when i am running this query i am getting the count of 134 records.
EXPECTED OUTPUT: here i need to get the count of 932 + 134 records = 1064 records.
I am using this query like below:
select * from i_invoice_info_t_log_v invlog,invoice_header_t invhead
where
(substr(invlog.tot_cust_no,1,7)=substr(invhead.acct_no,3,7)
and invhead.comp_code NOT in (2300)
OR
(substr(invlog.tot_cust_no,3,7)=to_char(substr(invhead.acct_no,3,7))
and invhead.comp_code in (2300)
)---------------------------------------------------here when i am running this query i am getting the count of 18381 records which is incorrect.
Expected output: i need to get the data for the comp_code which are not in 2300 and which are in 2300... bothselect *
from i_invoice_info_t_log_v invlog,
invoice_header_t invhead
WHERE (
substr(invlog.tot_cust_no,1,7) = substr(invhead.acct_no,3,7) --comparing tot_cust_no and acct_no for the other countries
and
invhead.comp_code NOT in (2300) --here when iam running this query i am getting the count of 932 records.
or (
substr(invlog.tot_cust_no,3,7) = to_char(substr(invhead.acct_no,3,7)) --comparing tot_cust_no and acct_no FOR THE COUNTRY 2300
and
invhead.comp_code in (2300) --Here when i am running this query i am getting the count of 134 records.
/SY. -
How to get the count of distinct customer in matrix?
Hi,
I want to get the count of distinct customer in matrix at the time of validation event.
Thanks Regards,Hi,
Please close the thread.by marking the correct answer
regards,
Prasad -
How to get the count of customers
Hi all,
We have a fact table, AR_F to which the dimensions Party_D and Fin_D are connected. Party-org_d is inturn connected to Party_d.
party_org_D contains details of customers like Customer name and customer ID (Number)
Fin_D contains ratings (Both -ve and +ve) of each customer.
the rating range is as follows,
good rating : >0
OK Rating: Between 0 and -1.5
Bad Rating: <-1.5
Now i need to get the count of all customers falling in each range as separate measures.
Kindly help me get a solution for this.
Thank you.Hi,
Try this....
col 1
case when Fin_D.ratings > 0 then 'Good'
when Fin_D.ratings >= -1.5 and Fin_D.ratings <= 0 then 'Ok'
when Fin_D.ratings < -1.5 then 'Bad' end
col 2
case when (case when Fin_D.ratings > 0 then 'Good'
when Fin_D.ratings >= -1.5 and Fin_D.ratings <= 0 then 'Ok'
when Fin_D.ratings < -1.5 then 'Bad' end)='Good' then count(customer_id)
when (case when Fin_D.ratings > 0 then 'Good'
when Fin_D.ratings >= -1.5 and Fin_D.ratings <= 0 then 'Ok'
when Fin_D.ratings < -1.5 then 'Bad' end)='Ok' then count(customer_id)
when (case when Fin_D.ratings > 0 then 'Good'
when Fin_D.ratings >= -1.5 and Fin_D.ratings <= 0 then 'Ok'
when Fin_D.ratings < -1.5 then 'Bad' end)='Bad' then count(customer_id)
end
hope helps........
Maybe you are looking for
-
IFS Transaction Isolation Level
We have implemented a batch process that loads content into IFS in a very large operation. We are using a transaction to handle rolling back the content if anything fails in the process so that we do not have to write a complex (and potentially unrel
-
How do I get rid of Bing? It has taken over my Firefox home page.
Every time I open Firefox, Bing loads as my home page. I have deleted from my internet options, etc., and it still takes over. There are a lot of other people having the same problem and you do not seem to be answering their requests for a solution.
-
Hi All, We have a Wireless Lan Controller 4402 with software version 4.0.155.5. On Friday we experience a problem where our clients wouldn't get redirected to the internal webpage for authentication. It would just come up with page not found. We know
-
How do I change font colour permanently in Mail.
Can someone tell me how to permanently change the font colour in Mac Mail. I have changed it from black to blue in preferences and also when I bring up the new message screen have changed to blue there also, but it still types out in black. So I wo
-
Runtime Error - Microsoft Visual C++
Guys, Trying to install Robohelp 9.0 for our users. Robohelp works fine, its just Robohelp for Word does not work at all and throws up an error every single time. We have applied the 9.0.1 patch also. These are Dell 980 boxes with Windows 7 64bit -