Calculating pivot table problem
Hello..PivotTable using separate columns for calculation... How to avoid it. ?
For ex:
My database of records are like
region date_id___amt_
01012009 1000 North
01012009 1000 North
01012009 1000 North
01012009 1000 South
01022009 1000 North
01022009 1000 South
01022009 1000 South
My pivot table design is
Line: region
Measure: Amt
Column: Date_id
I get a response such as
___Amt
01012009 01022009 _
_ Of the 1000 1000 North
_ Of the 1000 1000 South
But I need an output like
___Amt
01012009 01022009 _
_ Of the 3000 1000 North
1000 South _ 2000
I think that PivotTable has taken a distinct value for the calculation...
How could I get above exit... ?
Published by: Mohan 8732779 on September 1, 2009 04:03
Mohan,
What I got from above, is that you need a sum of the column. To change the aggregation behavior for amt column to say you said the aggregation would be separate. Just change to change the formula in sum, that it looks like something like this flat is what you want to achieve is not it?
By,.
Murielle.
Tags: Business Intelligence
Similar Questions
-
create the table mytable
(
name varchar2 (50).
name varchar2 (50)
)
Insert the table mytable values ('mary', 'john')
Insert the table mytable values ('mary', 'baby')
Insert the table mytable values ('mary', 'lady')
Insert the table mytable values ('sean', 'kate')
Insert the table mytable values ('sean', 'terry')
Insert the table mytable values ('kate', 'tom')
Insert the table mytable values ('kate', 'lary')
.
.
.
my result of the query is
last name first name
Jean-Marie
baby Marie
Lady Mary
Sean kate
Sean Terry
Tom Kate
Kate lary
I want to like this
Mary kate sean
John tom kate
baby terry lary
Lady
It's not all data.
the data are changeable.there are 3 name as name like sean John 2 2 lik kate and it will be 5 name like paul... I want as column name and surname as the data...
Thanks for your help...
Hello
Try this:
WITH number_rows AS ( SELECT name , surname , ROW_NUMBER () OVER ( PARTITION BY name ORDER BY surname ) AS r_num FROM mytable ) SELECT r_num , MAX (CASE WHEN name = 'mary' THEN surname END) AS mary , MAX (CASE WHEN name = 'sean' THEN surname END) AS sean , MAX (CASE WHEN name = 'kate' THEN surname END) AS kate FROM number_rows GROUP BY r_num ORDER BY r_num;
The output is not quite what you asked:
. R_NUM MARY SEAN KATE ---------- ---------- ---------- ---------- 1 baby kate lary 2 jon terry tom 3 lady
You do not have to display r_num: I showed just to make things easier to understand.
If the output should really include "Jean" rather than "jon", or if it should appear above 'baby', rather than below, so please explain.If the names in columns ("Mary", "sean" and "kate" in your sample data) should be determined at run time, you need dynamic SQL statements to generate a statement like the one above.
The script below shows one way to do this in SQL * more./* How to Pivot a Table with a Dynamic Number of Columns This works in any version of Oracle The "SELECT ... PIVOT" feature introduced in Oracle 11 is much better for producing XML output. Say you want to make a cross-tab output of the scott.emp table. Each row will represent a department. There will be a separate column for each job. Each cell will contain the number of employees in a specific department having a specific job. The exact same solution must work with any number of departments and columns. (Within reason: there's no guarantee this will work if you want 2000 columns.) Case 0 "Basic Pivot" shows how you might hard-code three job types, which is exactly what you DON'T want to do. Case 1 "Dynamic Pivot" shows how get the right results dynamically, using SQL*Plus. (This can be easily adapted to PL/SQL or other tools.) */ PROMPT ========== 0. Basic Pivot ========== SELECT deptno , COUNT (CASE WHEN job = 'ANALYST' THEN 1 END) AS analyst_cnt , COUNT (CASE WHEN job = 'CLERK' THEN 1 END) AS clerk_cnt , COUNT (CASE WHEN job = 'MANAGER' THEN 1 END) AS manager_cnt FROM scott.emp WHERE job IN ('ANALYST', 'CLERK', 'MANAGER') GROUP BY deptno ORDER BY deptno ; PROMPT ========== 1. Dynamic Pivot ========== -- ***** Start of dynamic_pivot.sql ***** -- Suppress SQL*Plus features that interfere with raw output SET FEEDBACK OFF SET PAGESIZE 0 SPOOL p:\sql\cookbook\dynamic_pivot_subscript.sql SELECT DISTINCT ', COUNT (CASE WHEN job = ''' || job || ''' ' AS txt1 , 'THEN 1 END) AS ' || job || '_CNT' AS txt2 FROM scott.emp ORDER BY txt1; SPOOL OFF -- Restore SQL*Plus features suppressed earlier SET FEEDBACK ON SET PAGESIZE 50 SPOOL p:\sql\cookbook\dynamic_pivot.lst SELECT deptno @@dynamic_pivot_subscript FROM scott.emp GROUP BY deptno ORDER BY deptno ; SPOOL OFF -- ***** End of dynamic_pivot.sql ***** /* EXPLANATION: The basic pivot assumes you know the number of distinct jobs, and the name of each one. If you do, then writing a pivot query is simply a matter of writing the correct number of ", COUNT ... AS ..."\ lines, with the name entered in two places on each one. That is easily done by a preliminary query, which uses SPOOL to write a sub-script (called dynamic_pivot_subscript.sql in this example). The main script invokes this sub-script at the proper point. In practice, .SQL scripts usually contain one or more complete statements, but there's nothing that says they have to. This one contains just a fragment from the middle of a SELECT statement. Before creating the sub-script, turn off SQL*Plus features that are designed to help humans read the output (such as headings and feedback messages like "7 rows selected.", since we do not want these to appear in the sub-script. Turn these features on again before running the main query. */
-
Running sum and Pivot Table graphics
Hello Experts,
I've shown measures execution of amounts in pivot table problem is when I try to pivotted results graphic I get the original values and not the running sum values. Is there a way to get around this or another way to do?
Thank you
Published by: ZaidN on June 29, 2010 07:20Do the following things.
(1) to restart all services
(2) use the resume function it shows the cumulative graph also
(3) accumulation of usage view on measure it in pivot does ' t shows resume graphic because the sum of runnung dynamically apply in pivot table, but the table takes the column.
...................
Vincent V -
reg: pivot table calculation
Hello
is there a way to get the average and total calculated in the pivot table based on a column?
example,
in the time of country state id
in pivot, I want to calculate total and average for the country / state of time according to the number of id of country / state
Thank youYes, you can. Make use of elements calculated to reach.
-
Hello.
I have a pivot table, and it should update that I change the value of selectOneChoice. I can only view some data in a PivotTable when I choose a value for the first time in selectOneChoice. If I select another value in the SelectOneChoice the PivotTable that is not updated.
Here is my PivotTable:
Can someone help me?<dvt:pivotTable id="pivotTable1" value="#{bindings.TValoresMatrizEnViewUp1.pivotTableModel}" binding="#{backingBeanScope.backing_valoresMatriz.pivotTable1}" contentDelivery="immediate" var="matrix" visible="false" partialTriggers="::socCodigo" rendered="true" > <dvt:dataCell> <af:inputText value="#{matrix.dataValue}" valueChangeListener="#{backingBeanScope.backing_valoresMatriz.alteraPivot}" autoSubmit="true" partialTriggers="it5" id="it5"/> </dvt:dataCell> </dvt:pivotTable>
My JDeveloper is 11.1.1.4.0
Thank youHi Marcos,
Open your page definition and together in the iterator tag refresh properties = 'always' and cacheResults = "false"...
That that it will solve your problem.
Kind regards
Renan
-
Hello
I need to create a named calculation in a pivot table similar in total general on columns. However, I need to customize the calculation to perform on some lines and average amount on some lines.
How can it be reached, the calculations will be appear in the same column for each row.
Can anyone help?
Thank youI don't know or force to try any time, but stuck in mind.
Contribution - ID no
9147.29 - 1
1043.16 - 1
Total 10190.45 - 2create a new column and write f (x) case when 1 = column_name 0 another amount (contribution) / sum (ID no.) end
see you soon,
KK -
For Timo: Dynamically create pivot table binding
Hi Timo,
Long time ago you have this announcement on a thread:
"The solution for your use a 2013 DOAG case, I presented was to create binding table pivot out user defined attributes in the table."
For the defined attributes, VO is created dynamically and the pivot link.
The pivot link is exchanged during execution as well as the activation of the adequate VO Dynamics to get only the
necessary data for the pivot table in particular.
......
I can't give you a working example because it is too complex. I can make available slides, but they are in German. "
We have the same problem.
Can you please send me this presentation on: email address removed by the moderator - there is no private through this public forum consultation >
I can't find this Presentation on the Internet.
Maybe, if you have some examples of simple work, too.
Kind regards
Diana
Diana, you can get the DOAG2013_DynamicPivotTable_virtual7 blades | JDev & ADF Goodies
The sample is too complex to be made available through my blog.
Timo
-
Remove sorting in a Pivot table view
Hi people,
How to remove the column header sort options in the pivot table view?
Thank you
AJ
You want to remove the small arrows on the column header in a pivot view?
If so, the options are available in the analysis criteria tab. The problem is it cannot be set to a point of view, they perform the whole analysis
In the criteria-> Properties tab right next to the filters and the stages of selection analysis-> Interactions tab.
Mark, if this can help
-
How to get the QDR of ADF Pivot table datacell
JDeveloper 11.1.1.5 version
Java 1.6
The ADF faces
I want to click commandlink in a data cell that sends the value of the header cells to a bean of support. I think that we must get the QDR of a clicked data cell, but how?
I created the PivotTable: column headers consist of a variable number of dates; row headers consist of the names of the units. The data that cross are a percentage of variance using energy over time. (There is no calculation in the PivotTable, just displaying data from the view).
........ 11 Jan 12 13 Jan Jan jan 14. .etc
Module-1 2.00 5, 25 - 9.30-11.15
Unit-2 - 554.22 497.00 7.70 2.00
Unit-3 10.00 - 5, 00 5.00 1.00
To the cell above it with 497.00 value, the user must click this value (commandlink) and the bean 1) calculate the values of the unit and the date to use as parameter values for ExecuteWithParams under another iterator and 2) navigate to another page using this another iterator.
It seems that the QDR (reference data) is involved, but can't find enough information about how to implement the same.
Here are the PivotTable on the jspx:
< dvt:pivotTable id = "pivotTable1".
Summary = "reading analytical pivot table.
value = "#{bindings." CdsaReadingsItfVwView1.pivotTableModel}.
var = 'cellData.
varStatus = "cellStatus" >
< dvt:dataCell >
< af:commandLink id = "cl".
Text = "#{cellData.DataValue} '"
action = "#{pivot_bean.commandlink_action}" / >
< / dvt:dataCell >
< / dvt:pivotTable >
In the bean, we try to getPivotTable(), but it is always null.
Any direction is welcome.
David KCheck how the PivotTable selection demo was created:
http://jdevadf.Oracle.com/ADF-richclient-demo/faces/feature/PivotTable/pivotTableSelection.JSPX
Code for this demo here:
http://www.Oracle.com/technetwork/developer-tools/ADF/documentation/ADF-faces-RC-demo-083799.html -
Hello
I can place the Pivot Table guest column does not display values section in the menu drop-down showing only a single value.
Version is 11.1.1.6.4 OBIEE and Mozilla Firefox 19.0.2
How to overcome this problem.
THX,If the column contains more than 1 value then browser. Check in IE or Chrome.
-
Calculate the % with the pivot table columns
I created an application with these columns:
I want to create a pivot table looks like this.Metric Study Fast Slow On-Target Total --------------------------------------------------------------------------------- Metric1 Study1 1 0 0 1 Metric1 Study2 1 0 0 1 Metric1 Study3 0 0 1 1 Metric1 Study4 0 0 1 1 Metric1 Study5 0 1 0 1 Metric1 Study6 0 1 0 1 Metric1 Study7 0 0 1 1 Metric1 Study8 0 0 1 1 Metric1 Study9 1 0 0 1 Metric1 Study10 1 0 0 1
The fast, slow, on the target and Total columns are calculated fields. Picky, I'm having is to get the % columns to work. I also tried create columns % in the form of columns of the table, but at each level of study, the % is 100% or 0%.Metric Fast Slow On-Target Total % Fast % Slow % On Target ------------------------------------------------------------------------------------------------------ Metric1 4 2 4 10 40 20 40
I tried with duplicate columns, all different options to display the value as. None of them worked.
Could someone help me? The version of the OBI is 10.1.3.4
Thank you
Shi-ning
Published by: SPUD on November 21, 2011 23:09Sounds like it. You will need the account of studies as a measure in the criteria. You could do something in the repository, but the fastest way is:
Criteria:
Add the study in (it will not go into the PivotTable)
create new measure based on any existing measure that has the background you need with the formula:
cases where [existing] is not null then 1 else 0 endThis will give you 1 for each line that your measure in effect is valid. Add this new measure in the PivotTable and treat it as a normal amount.
-
White column in responses: Pivot table see
Hello
Greetings to all here...
I use Oracle Business Intelligence Suite Enterprise Edition 10.1.3.4.
I have created a report, the problem is that it shows some columns as empty when I display the result in responses, Pivot table view, the technical details:
Column name: sales - MTD
The column formula: IFNULL ('-common measures ".") Business-MTD sales", 0.00)
Aggregation rule: default
sample data:
JAN Feb customer account number
7053 < white > 22.00
Data for Jan present in the database, infact for January, the column is not non-existent in databased, Feb is present and is displayed correctly.
The column is of type DOUBLE, I want to display 0.00 instead of white, asking for your help.
I did a search in the forum, but could not get a solution.Try this,
Go to your report, the column - common measures. "' Turnover - BAT" in data marker select custom format
and put it in #, # 0;-#, # 0; 0
I hope it will work.Concerning
Blackburn -
Hi all
I use the Oracle 11 g database to develop my application.
I've created a generic column report.
For this I used the concept of PIVOT table.
My example query is
with pivot_data like)
SELECT DEPTNO, JOB, SAL, BISHOP
WCP
)
SELECT *.
OF pivot_data
PIVOT)
SUM (SAL)
FOR DEPTNO
IN (& P90009000_LIST.)
)
This output is
WORK BISHOP 10 20 30
--------- ---------- ---------- ---------- ----------
PRESIDENT 5000
7902 800 CLERK
7698 950 CLERK
7788 1100 CLERK
7782 1300 CLERK
7698 5600 SELLER
MANAGER 7839 2450 2975 2850
7566 6000 ANALYST
8 selected lines.
but I need the output as below
BISHOP OF WORK 10 20 30
--------- ---------- ---------- ---------- ----------
PRESIDENT 5000
THE 800 7902 CLERK
THE 950 7698 CLERK
1100 7788 CLERK
1300 7782 CLERK
5600 7698 SELLER
MANAGER OF 2450 2975 2850 7839
6000 7566 ANALYST
8 selected lines.
Come 10,20,30 pivot columns
How to do this in my application?
Thank you
Su.GI
Thanks Solomon.
I used the code below.
His job very well.
with pivot_data like)
SELECT DEPTNO, JOB, SAL, & P90009000_LIST., BISHOP
WCP
)
SELECT *.
OF pivot_data
PIVOT)
SUM (SAL)
FOR DEPTNO
IN (& P90009000_LIST.)
)
Thank you
Su.GI
-
Hi Experts,
Here's the requirement I need to sort the text Text_field field say to sort this column, I called another field. Sort_Text_field.
I have the pivot table as follows
Can I sort Text_field even if Sort_Text_field is not in the PivotTable on the side.
Thank you!
Month1-(Jan) Month2-(Feb) Text_field MetricValue1 MetricValue2
Thank you!!Just in case if helps others. Tim Dexter tanks
Follow this link: https://blogs.oracle.com/xmlpublisher/entry/new_skool_crosstabbing
Customization
One new feature that I discovered this week is the ability to show a single column and sort by another. I got a data set which was extracting the month abbreviations, we wanted to show for months through the top and headers of lines on the side. As you know XSL is not very good with dates, in particular recognizing the names of months. He just wants to sort them alphabetically, so, after comes before Jan, etc..
A way around this is to generate a number of months to the sides of the month and which allows to sort. We can do that in the crosstab, unfortunately it is not exposed in the user interface still but its doable.Go back and take a look at the initial crosstab command. especially the line inputs and columns. There, you will find the sort criteria.
"ProductsBrand {, o = a, t = t}, PeriodYear {, o = a, t = t}.
Note these key commas inside the braces? Because there is no field that precedes them, this means that the crosstab should sort on the column before the brace that is PeriodYear. But you can insert another column in the data set to be sorted. For myself how I needed to work.
<>" _Fund_Type_._Fund_Type_Sort_, o = a, t = n} ';' _Fiscal_Period__Amount__._Amt_Fm_Disp_Abbr_ {_Fiscal_Period__Amount__._Amt_Fiscal_Month_Sort_, o = a, t = n} ';' _Execution_Facts_._Amt_ ';' amount '? >
Excuse the horribly verbose XML tags, good ol' BIEE: 0) emboldened columns are not in the table, but in the data set. I just open the field, dropped and changed the value type (t) is 'n', number, instead of the default 'a' and my crosstab started sorting how I wanted that it.
If you find other tips and tricks, please share in the comments.
-
Pivot table result without aggregate function
Hi all
We have the following two tables:
SQL > select * from class;
CLASS_ID COURSES
---------- ----------
1 1
2 1
3 1
2 2
3 2
5 2
6 selected lines.
SQL > select * of course.
COURSE_ID
----------
1
2
The customer needs the output in the following format:
class class class class
1 1 2 3
2 2 3 5
I considered using the operator pivot tables however they require the use of an aggregate function, but there is no aggregation only required in the result here - we demand that the output as would a PivotTable?
Try this.
WITH class(CLASS_ID,COURSE) AS)
1.1 DOUBLE UNION ALL SELECT
SELECT 2.1 DUAL UNION ALL
SELECT 3.1 FROM DUAL UNION ALL
SELECT 2.2 DUAL UNION ALL
3.2 DUAL UNION ALL SELECT
SELECT DOUBLE 5.2)
SELECT * FROM)
SELECT THE COURSE
CLASS_ID,
ROW_NUMBER () OVER(PARTITION BY COURSE ORDER BY COURSE) RN
CLASS)
PIVOT (MAX (CLASS_ID) for (RN) IN (1 as CLASS1, 2 AS CLASS2, CLASS3 AS 3));
OUTPUT:
CLASS CLASS1 CLASS2 CLASS3
-------- ---------- ---------- ----------
1 1 2 3
2 2 3 5
Maybe you are looking for
-
Satellite Windows L50 - B - 2-4-10 Driver Support
When can we expect begin to receive the support of drivers for Windows 10. I tried upgrading to Windows 10, but many drivers do not install or operate fully due to compatibility issues. When Toshiba does intend to extend support for the new operating
-
Satellite L875 - 12 p - clicking noise
I used the Satellite L875 - 12 p for about a month. Since last week, I start noticing clicking noise occurs randomly between the right corner of the mouse touch pad. It's quite strange because this laptop is quite new. What should I do to fix this?
-
Cannot install this hardware. An error occurred during the installation of the device
Can someone please HELP ME - I get the following error message: cannot install this hardware. An error occurred during the installation of the device. They system cannot find the specified file. I am not able to connect any hardware. It started all o
-
put the icons on your screen saver
I've been using internet explorer 7 and downloaded internet explorer 8 and now I can not get my icons back on my screensaver do not know how to do it please help
-
How can I stop the false emails sent to my e-mail address I changed, but still happens
scam emails are sent to my contacts to repeadetly. I changed my address and password, but it's still the case.