Transpose and Pivot
Hi Gurus,
I would like to get the pivot result for following sql
SELECT TO_CHAR (A.AUDITTIMESTAMP, 'HH24') HOUR,
TO_CHAR (A.AUDITTIMESTAMP, 'DD-MM-YYYY') "DATE",
COUNT (*)
FROM PROCESS A
WHERE TO_CHAR (A.AUDITTIMESTAMP, 'MM%') IN (select TO_CHAR (sysdate, 'MM%') from dual)
GROUP BY TO_CHAR (A.AUDITTIMESTAMP, 'HH24'),
TO_CHAR (A.AUDITTIMESTAMP, 'DD-MM-YYYY') order by 1,2;Result
HOUR DATE COUNT
00 06-03-2012 2037
00 07-03-2012 1436
00 08-03-2012 1180
00 09-03-2012 1438
00 10-03-2012 1024
00 11-03-2012 2212
00 12-03-2012 1438
00 13-03-2012 1261Expected output in the following format
DATE 00 01 02 03 04.....
01-03-2012 1241 3858 7167 2443 7836
02-03-2012 859 3400 8379 2273 9445
03-03-2012 434 1787 6588 1617 1323
04-03-2012 236 1072 8955 13247 1630
05-03-2012 1354 3295 6685 2264 2442
06-03-2012 2037 3550 9280 2958 2816
07-03-2012 1436 4003 7397 2624 2239
and so on..Pivot function can be sum of count
Thanks
Raj
Creating a view of your query named hourly_audits, using DATUM as Alias for the DATE column and Q as Alias for the COUNT column:
SELECT a.datum,
a.Q "00",
b.Q "01",
c.Q "02"
FROM hourly_audits a, hourly_audits b, hourly_audits c
WHERE a.hour = '00' AND
b.hour = '01' AND
c.hour = '02' AND
a.datum = b.datum AND
a.datum = c.datum;etc.
Similar Messages
-
I am a new user to Oracle Reports and I am trying to convert many reports from our current environment in SAS.
We have many reports in our current SAS environment in which we basically transpose (pivot) our data before we produce the report. There is an easy way to accomplish this in SAS - "Proc Transpose". I have looked into completing this in the SQL first but can't get it exactly how I need it and then in some cases it would need to run dynamic which I know is possible in PL/SQL but not simple.
I was thinking the reports builder would do it for me.
Here is an example of the data before transposing:
Channel ReportingMonth napp dapp
a September-03 1000 1000000
a October-03 2000 2000000
a November-03 1500 1500000
b September-03 1000 1000000
b October-03 2000 2000000
b November-03 1500 1500000
Here is an example of the data after transposing and really what the report needs to look like:
Channel Measurement September-03 October-03 November-03
a NAPP 1000 2000 1500
a DAPP 1000000 2000000 1500000
b NAPP 1000 2000 1500
b DAPP 1000000 2000000 1500000
My thought is somehow in a Matrix report, but I don't want the Matrix Cell Fields to show under the Matrix Column Fields.
Any help would be grealy appreciated.stacy,
you will need to generate the matrix report using the wizard and then manually manipulate the cells and the headings so they follow your required positioning.
regards,
philipp -
How do I transpose and group a table in a ViewObject?
Hi,
I want to transpose and group a table within a view object and don't know how to do it.
Please let me explain what I want to do:
One table, e.g. Employees, has one row per employee. Each employee has a departmenent and a room assigned:
Employee
Department
Room
John
Finance
101
Susie
Prod
102
Hank
Finance
103
Now I want to show one row per departmenent and a marked checkbox for each room that has an employee from this department in it:
Department
Room 101
Room 102
Room 103
Finance
X
X
Prod
X
What I already did is, I added a transient attribute of type boolean for each room to the ViewObject for employees. I was able to set the booleans within the method ViewObject::createRowFromResultSet. But I still need to do a grouping by department.
What I don't understand is: is it possible to 1. selecting data, 2. grouping the result and 3. setting booleans for the rooms, anything in the same view object? Or do I need to have two ViewObjects, one that holds the data and another one that prepares and to displays the data?
Btw. the users will change the checkboxes and the changes must be written back to the database (makes no sense for this example, I know...).
Could anything be done in the same ViewObject? If so, which methods do I have to overwrite to do the grouping?
Could someone please give me a hint or let me know where I can find an example of a similar scenario?
Thanks in advance!Sort the playlist into the desired order, e.g. click the heading for the track no. or album columns, the right-click on the playlist name and click Copy to Play Order. The playlist should now burn in the correct order.
tt2 -
Publisher 11.1.1.5 graph and pivot problem
Hi,
I use publisher 11.1.1.5. My graph (for RICAVO) show only integer values and pivot table (for QTA) get the error message. Only normal table generation is successful. I used layout template editor.
My example data is:
<DATA_DS>
<G_1>
<ID_PROD>53</ID_PROD>
<DESCR>Rac1</DESCR>
<QTA>1021755</QTA>
<RICAVO>4268165.45</RICAVO>
</G_1>
<G_1>
<ID_PROD>54</ID_PROD>
<DESCR>Rac2</DESCR>
<QTA>334344</QTA>
<RICAVO>1419017.22</RICAVO>
</G_1>
<G_1>
<ID_PROD>51</ID_PROD>
<DESCR>Rac3</DESCR>
<QTA>1137378</QTA>
<RICAVO>4689214.45</RICAVO>
</G_1>
<G_1>
<ID_PROD>56</ID_PROD>
<DESCR>Tel1</DESCR>
<QTA>614434</QTA>
<RICAVO>2264936</RICAVO>
</G_1>
<G_1>
<ID_PROD>9</ID_PROD>
<DESCR>Cert</DESCR>
<QTA>42006</QTA>
<RICAVO>178209</RICAVO>
</G_1>
<G_1>
<ID_PROD>57</ID_PROD>
<DESCR>Tel2</DESCR>
<QTA>403921</QTA>
<RICAVO>2000968</RICAVO>
</G_1>
<G_1>
<ID_PROD>46</ID_PROD>
<DESCR>Lett1</DESCR>
<QTA>239816</QTA>
<RICAVO>262993.03</RICAVO>
</G_1>
<G_1>
<ID_PROD>44</ID_PROD>
<DESCR>Lett2</DESCR>
<QTA>71952</QTA>
<RICAVO>76164.45</RICAVO>
</G_1>
<G_1>
<ID_PROD>58</ID_PROD>
<DESCR>Tel3</DESCR>
<QTA>57375</QTA>
<RICAVO>205802</RICAVO>
</G_1>
<G_1>
<ID_PROD>21</ID_PROD>
<DESCR>Po</DESCR>
<QTA>6785</QTA>
<RICAVO>536015.98</RICAVO>
</G_1>
<span id="skype_highlighting_settings" display="none" AutoExtractNumbers="1"/>
</DATA_DS>
the pivot preview (for QTA) in layout editor is:
53 54 51 56 9 57 46 44 58 21
rac1 NaN
rac2 334344
rac3 NaN
Tel1 614434
Cert 42006
Tel2 403921
Lett1 239816
Lett2 71952
Tel3 57375
Po 6785
there are two Nan values!!!
What kind of problem would be?
Edited by: 957438 on 6-set-2012 7.47
Edited by: 957438 on 6-set-2012 7.49The problem seems to be scientific notation. Values that are higher than 1000000 are automaticalli conver.ted in scientific notation and they aren't recognized in graphs and pivot.
Indeed online analyzer show this values with the integer part only, i.e. 4,5E10 is showed as 4. How i can avoid automatic scientific notation? -
Charts and pivot tables are not generated in Seed Cache using iBots
Hi,
I have been working on OBIEE cache. I encountered few issues.
1. We scheduled ibots to run daily and deliver dashboards to seeding cache. But the cache is not getting created for some reports which have charts and pivot tables in the dashboards .
We are using OBIEE 10.1.3.3.1.
2. When an end user logs in and access dashboard, the query is hitting the database.
3. The sql query for reports which got created in server cache are not the same as sql query generated when an end user logs in to access dashboard. The difference being query generated when an end user is accessing dashboard is using aggregates.
4. Please let me know if anyone has faced same issue and any solutions.
Any help is appreciated
Thanks,
SwethaHi,
I have been working on OBIEE cache. I encountered few issues.
1. We scheduled ibots to run daily and deliver dashboards to seeding cache. But the cache is not getting created for some reports which have charts and pivot tables in the dashboards .
We are using OBIEE 10.1.3.3.1.
2. When an end user logs in and access dashboard, the query is hitting the database.
3. The sql query for reports which got created in server cache are not the same as sql query generated when an end user logs in to access dashboard. The difference being query generated when an end user is accessing dashboard is using aggregates.
4. Please let me know if anyone has faced same issue and any solutions.
Any help is appreciated
Thanks,
Swetha -
Can I navigate and drill down in chart and pivot table?
In the fact, the end user want to navigate to a detail report request when drill down to the final level.
I know when use table, I can navigate on data and drill down on column.
But in chart and "pivot table", I do not find the option of interaction to achieve this.
Any suggestion?You can drill down in charts but I just saw you can't in pivots (strange because I assumed that that must be possible)
However, you can always use guided navigation! -
Registration and pivot point issue
The pivot/rotation points default back to the center of the symbol when I drag them from the library for later use.
Here's what's happening. I create a symbol, double click to edit and set the registration point (the cross hairs); the pivot point (the white dot) automatically moves to the registration point. Great! When I drag the same symbol from the library to the stage in a later scene the registration point is the same but the pivot point has defaulted to the center position of the symbol. How do I keep this from happening? Am I leaving out a step? Help, please!Never mind. I think I figured it out; create the object on the stage, edit the registration and pivot points in the symbol in the library, return to stage, right click symbol and 'set transformation point.' I might be able to set that last action as a hot key.
Thanks for all your help. You should write the manuals. -
I recorded a bass part. when i brought it into the multi track editor area and tried adjusting the transpose and clip speed, nothing happens. when i choose a different clip speed, it just goes back to normal and when i adjust the transpose it doesn't sound any different. it's an aiff file and i've tried it as wav and mp3. am i missing a step? thanks.
Clip Speed and Transpose.....
Are for Apple Loops only. Make the file an Apple Loop. -
Questions on Track Transpose and Score Layout
Hi all -
I'm posting these questions for my 14-yr old son who is the Logic Express user, so apologies as I might be asking the questions the wrong way. :-)
My son is writing an arrangement of the song Friday (Rebecca Black) :-) for his Middle School Marching Band. It sounds pretty cool so far, btw, and I have to admit the song is quite catchy. Haha.
Question 1: Is there a way to transpose a track independently of other tracks? As you know, some marching band instruments (flute, clarinet, etc) play natively in a different key, and he wants the appropriate key to show in the printed score. When he sets the key for a given track, every other track is changed as well, which won't work.
Question 2: When printing the score, is there a way to remove the bass clef? For some instruments (trumpet, for example) there are no notes in the bass clef and it's a waste to print the bass clef at all. He just wants the score to be more compact (and use less paper).
I hope I did his questions justice. :-) Any feedback would be very helpful! Thanks!So I asked my son if I asked his questions correctly, and I guess I didn't. :-/ So, thanks, anyway, for reading. I'll be posting a different question shortly.
Mods: Please delete if needed. Thanks! -
How to fix Action Link Issue in Table and Pivot Table when used Section
My OBIEE Version: OBIEE 11.1.1.6.5
Issue Description: Action links (Navigate to BI Content) doesn't work in PIVOT TABLE or TABLE object when used Section area (one or more columns in Section area).
If you want to recreate this issue please follow next steps:
1. First of all you have to create one analyse with min 3 columns (for example Time.“Calendar date“, Product.Product, „Base Fact“. Revenue -> from Sample Sales Lite )
2. From column properties -> Set value Action Link Interaction on some column for example Product.Product (choose Navigate to BI Content -> any created BI report )
3. Click Results Tab choose Pivot Table and assigned one dimension column to Section area
4. Click preview icon
5. When you click on action link nothing happens
6. If you drug and drop column from Section Area to Excluded, Table or Pivot table Area then Action Link works perfectly
How to fix this issue?
I'll be grateful for any help!This is Bug:15922681 - ACTION LINK NAVIGATE TO BI CONTENT DOES NOT WORK WITH ATTRIBUTE IN SECTION
Upgrade to 11.1.1.6.6 will fix this issue. -
Apex 5.0, Horizontal scrollbar for Interactive Report and Pivot Format
Hi,
i would like to know how to have an horizontal scrollbar for an interactive report (5.0) after making a pivot from the user interface; i have a lot of columns and without the pivot the horizontal scrollbar appears . After it doesn't appear.
I tried with the Region Header <div style="overflow:auto;"> and Region Footer </div> but without success.
Regards
GianpaoloHi gianpagi,
gianpagi wrote:
i would like to know how to have an horizontal scrollbar for an interactive report (5.0) after making a pivot from the user interface; i have a lot of columns and without the pivot the horizontal scrollbar appears . After it doesn't appear.
I tried with the Region Header <div style="overflow:auto;"> and Region Footer </div> but without success.
Please mention the theme and template you are using for the Interactive Report.
Can you re-produce the issue on apex.oracle.com and share the workspace credentials, so that can have closer look at the issue?
Regards,
Kiran -
Dynamic SQL and Pivot Query in 11G
Hello all,
I am using APEX and 11G I am trying to create a report based on the results of a pivot query. Below is the code to build the query string. The :P4_EPSB_PERIOD_HOLD holds data like (SEP-08') for example.
declare
q varchar2(4000);
begin
q:=q ||' select * FROM';
q:=q ||' ( ';
q:=q ||' select segment2, ';
q:=q ||' accounted_dr, ';
q:=q ||' period_name ';
q:=q ||' from gl_je_lines a, ';
q:=q ||' gl_code_combinations b';
q:=q ||' where b.code_combination_id = a.code_combination_id';
q:=q ||' and segment2 >= :P4_EPSB_OBJECT_FROM';
q:=q ||' and segment2 <= :P4_EPSB_OBJECT_TO';
q:=q ||' and period_name IN :P4_EPSB_PERIOD_HOLD';
q:=q ||' and segment4 >= :P4_EPSB_LOCATION_FROM';
q:=q ||' and segment4 <= :P4_EPSB_LOCATION_TO';
q:=q ||' )';
q:=q ||' PIVOT';
q:=q ||' (';
q:=q ||' sum(accounted_dr)';
q:=q ||' for period_name IN :P4_EPSB_PERIOD_HOLD';
q:=q ||' )';
return q;
end;
I get the missingfailed to parse SQL query:
ORA-00906: missing left parenthesis
If I print the sql statement that the query generates, I get the following code, which, if the varaibles are hard-coded, works fine.
select * FROM ( select segment2, accounted_dr, period_name from gl_je_lines a, gl_code_combinations b where b.code_combination_id = a.code_combination_id and segment2 >= :P4_EPSB_OBJECT_FROM and segment2 <= :P4_EPSB_OBJECT_TO and period_name IN :P4_EPSB_PERIOD_HOLD and segment4 >= :P4_EPSB_LOCATION_FROM and segment4 <= :P4_EPSB_LOCATION_TO ) PIVOT ( sum(accounted_dr) for period_name IN :P4_EPSB_PERIOD_HOLD )
Any advice as to how to tackle this would be most welecome and appreciated.
ThanksP4_EPSB_PERIOD_HOLDcome with single quotes? like 'SEP-08' or SEP-08
-
Sql query transpose or pivot info
we have table with hundred thousand plus users.for each user we have two rows,meaning two test areas,in this case 67 and 75 and each testarea has a flag. not sure this is relevant here but some testers have test areas with same flag and some times different
SQL> desc testers
Name Type
tester_ID NUMBER
test_area_id NUMBER
flag VARCHAR2
SQL > select * from testers;
tester_ID test_area_ID flag
439788 67 Y
439788 75 N
434529 67 P
434529 75 P
434576 67 P
434529 75 X i am looking to split the testarea flag so i can have one row for each tester rather two.
tester_ID test_area_ID_67_flag test_area_ID_75_flag
439788 Y N
434529 P P
434576 P X i tried few with partation row over but not quite getting there.any help/ideas are greatly appreciated
thanksHi,
Starting in Oracle 11, you can also use the SELECT ... PIVOT feature.
See the following thread for an example:
Re: rows to column in 11g as single query -
Guage and Pivot table uses in OBIEE
Hello Folks,
please help to understand what is PIVOT TABLE and GAUGE in OBIEE answers
in what cases or scenario will this things be used.
and what is CASE in OBIEE, where is it used and what is its use .
thanks in advance
KMRThe pivot table view is an interactive view that allows you to rotate the rows, columns, and section headings to obtain different perspectives of the data. Pivot tables are navigable and drillable, and are especially useful for trend reports.
Gauges are useful for showing performance against goals. Supported gauge types include dial, bar, and bulb-style gauges.
CASE statement is used for conditions, usage is case when x=y dothis end.. Its like IF statement in programming.
- Madan -
Difference beween Case Statement and Pivot Operator in a OWB mapping
Hi ,
Kindly clarify what is the difference between using a PIVOT operator and the CASE statement in a Expression Operator in a particular mapping.
rgds
ArinjitHi
With PIVOT operator you can transform columns to rows. For example if oyu have 12 column (one for every months) than you can create 12 rows with one column of month data.
If you want to do this without PIVOT you can do it with union (12 times) or with
something like this.
In this case you can't use CASE statement I think.
If you want to do the reverse of this, create 12 column from 12 rows, you can use UNPIVOT operator. In this case you can use CASE statement and aggregating.
Ott Karesz
http://www.trendo-kft.hu
Maybe you are looking for
-
Reading .log file & Sorting input
Hello all Currently I'm working on a projekt were I have to read a "in.log" file, sort it and save it to another "out.log" file, the contents of the in.log file is: [204.0.44.73]: Dir: path [204.0.44.73]: Dir: path [204.0.44.74]: Dir: path [204.0.44.
-
Hi All, I am beginner in OAF. We want to add a new field in a OAF page. We wanted to do it by extending Standard VO i.e. present already. Now will it be sufficient if I download only View Object and XXPG.xml related to the OA Page or should I downloa
-
G3 IBook 2001 Dual System 9 & 10 won't start
I have a white IBook that I want to give to my grandaughter for her homwork. It has systems 9 and 10 on it. I took all of my files off the system 9 and restarted in system 10 (which worked before). There is a momentary happy mac then it breaks into t
-
Hello, As stated in the subject line, my printer seems to stop printing after sitting for a few weeks. I don't know how I end up getting it to print again, I just keep trying different things and with luck some how it starts to print again, SOMETIM
-
I accidentally downloaded keynote instead of pages, can I get a credit?
I accidentally downloaded keynote, when I meant to download pages. How do I go about getting keynote removed and a credit for this accidental purchase?