"Top n" selection and percentages in a pivot table
Hi all,
I have a problem with calculating/display of percentage figures in a pivot table that I need some help on.
For a given month, I'm reporting the web browser logins, by browser type. So for example:
2010/03, IE, 50
2010/03, Firefox, 30
2010/03, Chrome, 10
2010/03, Others, 10
Totalling 100 ( and their produce the same value as a % ). However, if I apply a filter on the browser that does a select of the Top 2 for the month, the IE & Firefox total 80 and displays the % values as:
2010/03, IE, 62.5%
2010/03, Firefox, 37.5%.
So I can see that really what I need to do is to filter the columns being displayed as the "Top 2" not selecting the data onbeing in the top 2.
Can anyone advise on how to do this/is it possible.
Thanks in advance.
Hi you can try like,
1. create a duplicate column for browserlogins and set its level as month and name it as totallogin.
2. create a calculated measure for the original browserlogins column. Choose the totallogin to compare against that column.
3. choose percent in the new calculation tab.
4. Bring this column iinto the presentation layer.
5. use this column in the report.
Check what it is showing. I dint try this out. Just a guess. If its helpful award some points.
Thanks,
Karthick
Similar Messages
-
Calculated Percentage Columns in Pivot Table loose formating in Excel
I have a simple report built using pivot table ( OBIEE 11.1.1.5.0)
1 Metric and 1 dimension using pivot table. and I duplicated the metric column and change it to % column.(Show data as % of column). SO far so good. Below is the snapshot
http://tinypic.com/r/2s14xa9/7
Now i download the report in excel and all the % values are messed up . Below is how it looks
http://tinypic.com/r/bede90/7
I tried messing with data formats etc..nothing works.. I cannot add a custom column format to the metric column since it will impact the derived % column.
Is this a bug ?Any pointers ..
ThanksHi,
Follow up this SR:
SR 3-5060435331: Calculated Percentage Columns in Pivot Table loose formating in Excel
Workaround: (not sure may be give a try)
also give a try like below one then try to download it may work.
In that % column -->add the below statement in the Custom CSS section of the column properties:
mso-number-format:"\@"
Refer snapshot here:
http://i53.tinypic.com/a09kqv.jpg
This will treat the data in the column as text while downloading to excel, hence retaining any leading or trailing spaces.
Thanks
Deva -
How to drill down and keep all my pivot table...
Hello experts!
I have a question about how to drill-down in pivot table. If I drill-down I can see the result in the same place...but it dissapear other bins or measures...
Example:
Pivot table:
A
B
C
If I click in A I can see:
a1
a2
a3
But I don't see B and C.
I would like to see when I click on A:
A
---a1
---a2
---a3
B
C
In my example I have a lot of bins to do drill-down...so it doesn't work for me to create three pivot tables and to do a union...
Is that possible? If you need more details you can post here...
Thank you!Alex, this isn't another question. It looked like you were asking something different. That's why I said to start another thread. The bottom line is that OBIEE can't do what you are looking for.
But I think what is more important is not necessarily how to do what the OP wants, but what is the best way (read: most efficient, simplest, viable) to achieve the goal.
In this case, I think a better approach to your reporting is to use to Dashboard prompts. The first would be like Vehices (which has Cars, Trucks, Motorcycles, etc. in the drop-down window) and the second, constrained on the first, called Models/Brands (which has values dependent on what is chosen in the first prompt). With "All Choices" checked off in the prompt design, you have all the combinations a user needs to see in the pivot table. If the user chooses "Cars" from the first prompt, and "All Choices" in the second, then he/she will get all the car models displayed in the pivot table. Or, the user could select one particular moded from the start.
In fact, this is how many product web sites are set up. This gives the flexibility to the user and the report looks clean and efficient. You can have the drill down on the particular model (value interaction) if you wish to supply extra data on the particular model chosen.
I think this is the "correct" answer, Alex, though not the answer to the question you posed. Good luck. -
Calculating percentage change in pivot table
Hi,
In my requirement i want calculate percentage change of revenue in month wise(i.e.,by comparing current month previous month).that result should display in pivot table.but iam not getting values.can any one know.plz give sol ASAPRead these:
http://catb.org/~esr/faqs/smart-questions.html#homework
http://catb.org/~esr/faqs/smart-questions.html#beprecise
Try again, and hopefully, there will something someone can respond to. But don't ask to "give the solution." That's your job. We'll help, if we can and if we have the time. Good luck. -
Issue with null rows and calc measure in pivot table
hello;
id like to ask if anyone encountered a similar behaviour in OBI and if there is woraround for that;
in my BM i have 2 facts tables; i added in BM logical layer a calculated measure (calc_value) ,which is based on 3 other measures coming from these 2 facts tables
:calc_value= value1 / (value2+value3) ; value1 coming from fact1 and value2 / vfalue3 coming from fact2
depending on the chosen dimensions/level in report, the result of the calcuated measure is different ,which is correct;
the lowest level in fact1 and fact2 are customer/product.
in Answers when i select this calculated measure into report, a full outer join gets created, joining these 2 facts tables on all the dimensions that were chosen into the report i.e. in my case year/region/customer/product.
as a result there are null rows created in the db query, if some of these combinations exist in 1st fact table , and do not exist in 2nd fact table and other way round;
when i display result as a table, i can see the calculated measure only on the lines that are common for both fact tables and this is correct;
however - when i create a pivot table, and DO NOT select into the pivot the customer/product (so the lowest level), but still select these items into criteria, then the calc_value is not displayed correctly; instead of the value that would be shown as if calculated at the higher level i.e. year/region, simply 0 is displayed;
i was wondering how this can be corrected, so that OBI displayes in pivot the calc_value as of the level which is shown in pivot (so if i show in pivot year/region/customer/product -> then at this level; if i put customer/product to 'exclude' in pivot, then the level should be year/region);
i noticed if i filter out at least 1 combination that create null rows then the values are shown correctly in pivot (but the db query still contains null rows), so i tend to think this is presentation issue, not design;
id appreciate any tips on how to resolve this issue
OBI vesion: 10.1.3.2
thx
rgdsHi write a case statement during logical column such that when value is present it takes value else zero for call the values i.e. value1, value2, value3.
i.e. case when column1 is not null then column1 else 0.
Then, do the calculation.
Hope this might helpful for you. -
Percentage calculation in pivot table per row
Hello all,
I do calculate two fields in a pivot table. First calculated field is the # of activities per user (standard SoD reporting field). Second calculated field is the # of activities per user with a certain classification (customized pick list field that is converted in a from a text value to a integer value ==> CASE WHEN Activity.Type = 'Call' THEN 1 ELSE 0 END).
In the pivot table I do show both vlaues as a sum. I would like to calculate the percentage per row per user.
Example:
User - # activities - # calls - percentage
User XY - 80 - 40 - 50%
Thanxs for your help
Elmarhave you # Call column look like
sum(CASE WHEN Activity.Type = 'Call' THEN 1 ELSE 0 END) -- column2
create the percentage column with # activities / column2
under the column property of the percentage column --> Data Format -->Treat Numbers As --> percentage.
leave the Aggregation Role as default on all columns.
Hopefully, I didn't miss anything.
Shilei -
Calculating growth percentage in a pivot table
I have a pivot table with the following data generated by a pivot table of customer and sales data. The pivot table is showing the 2010 and 2009 data.
Sales
Customer 2010 2009
ABC 1000 800
DEF 2000 1000
How would I get the calculation to show the % growth from 2009 to 2010 shown below ??
Sales
Customer 2010 2009
ABC 1000 800 25%
DEF 2000 1000 100%
Thanks for any helpRe: how to Make a report from two cubes
This link will help you. -
Selecting and skipping rows in a table
Hi ALL, i have two tables with the following data
WITH table1 AS
SELECT 517 id, 'TA33' cid, To_Date('1/1/2010','mm/dd/yyyy') dt, 90 src, 'MEDREC-C' name, 'FIN' lvl_1, 'FCS' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 517 id, 'TA33' cid, To_Date('1/1/2010','mm/dd/yyyy') dt, 88 src, 'MEDREC-L' name, 'FINA' lvl_1, 'FIC' lvl_2, ' BAN' lvl_3 FROM dual UNION all
SELECT 517 id, 'TA33' cid, To_Date('1/1/2010','mm/dd/yyyy') dt, 91 src, 'MEDREC-H' name, 'BA' lvl_1, 'BAING' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 517 id, 'TA33' cid, To_Date('1/1/2010','mm/dd/yyyy') dt, 59 src, 'MEDREC-R' name, 'FIN2' lvl_1, 'FCY' lvl_2, ' BANW' lvl_3 FROM dual UNION ALL
SELECT 517 id, 'TA33' cid, To_Date('1/5/2010','mm/dd/yyyy') dt, 90 src, 'MEDREC-C' name, 'FIN22' lvl_1, 'FCS22' lvl_2, ' BAN22' lvl_3 FROM dual UNION ALL
SELECT 517 id, 'TA33' cid, To_Date('1/5/2010','mm/dd/yyyy') dt, 88 src, 'MEDREC-L' name, 'FINA' lvl_1, 'FIC' lvl_2, ' BAN' lvl_3 FROM dual UNION all
SELECT 517 id, 'TA33' cid, To_Date('1/5/2010','mm/dd/yyyy') dt, 91 src, 'MEDREC-H' name, 'BA' lvl_1, 'BAING' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 517 id, 'TA33' cid, To_Date('1/5/2010','mm/dd/yyyy') dt, 59 src, 'MEDREC-R' name, 'FIN2' lvl_1, 'FCY' lvl_2, ' BANW' lvl_3 FROM dual UNION ALL
SELECT 518 id, 'TA35' cid, To_Date('1/2/2010','mm/dd/yyyy') dt, 90 src, 'MEDREC-C' name, 'IND' lvl_1, 'IMAN' lvl_2, ' CO' lvl_3 FROM dual UNION all
SELECT 518 id, 'TA35' cid, To_Date('1/2/2010','mm/dd/yyyy') dt, 88 src, 'MEDREC-L' name, 'IND' lvl_1, 'CAP' lvl_2, ' CO' lvl_3 FROM dual UNION all
SELECT 518 id, 'TA35' cid, To_Date('1/2/2010','mm/dd/yyyy') dt, 91 src, 'MEDREC-H' name, 'EMAC' lvl_1, 'COG' lvl_2, ' CO' lvl_3 FROM dual UNION ALL
SELECT 519 id, 'TA23' cid, To_Date('1/3/2010','mm/dd/yyyy') dt, 59 src, 'MEDREC-R' name, 'UYS' lvl_1, 'TYU' lvl_2, ' CO' lvl_3 FROM dual UNION all
SELECT 519 id, 'TA33' cid, To_Date('1/3/2010','mm/dd/yyyy') dt, 88 src, 'MEDREC-L' name, 'UYS2' lvl_1, 'TYU2' lvl_2, ' CO2' lvl_3 FROM dual UNION ALL
SELECT 519 id, 'TA23' cid, To_Date('1/7/2010','mm/dd/yyyy') dt, 59 src, 'MEDREC-R' name, 'UYS66' lvl_1, 'TYU66' lvl_2, ' CO1' lvl_3 FROM dual UNION all
SELECT 519 id, 'TA33' cid, To_Date('1/7/2010','mm/dd/yyyy') dt, 88 src, 'MEDREC-L' name, 'UYS2' lvl_1, 'TYU2' lvl_2, ' CO2' lvl_3 FROM dual UNION ALL
SELECT 520 id, 'TA2' cid, To_Date('1/4/2010','mm/dd/yyyy') dt, 88 src, 'MEDREC-L' name, 'UYS6' lvl_1, 'TYU' lvl_2, ' CO' lvl_3 FROM dual
-- there is more data with different id nuimbers
table2 AS
SELECT 90 src, 'YB' name FROM dual UNION ALL
SELECT 59 src, 'YC' name FROM dual UNION all
SELECT 91 src, 'BB' name FROM dual UNION ALL
SELECT 88 src, 'YI' name FROM dual
)i want to write a query that gives the me output below
ID CID DT SRC NAME LVL_1 LVL_2 LVL_3
517 TA33 1/1/2010 90 MEDREC-C FIN FCS BAN
517 TA33 1/5/2010 90 MEDREC-C FIN22 FCS22 BAN22
518 TA35 1/2/2010 90 MEDREC-C IND IMAN CO
519 TA23 1/3/2010 59 MEDREC-R UYS TYU CO
519 TA23 1/7/2010 59 MEDREC-R UYS66 TYU66 CO1this is the logic for the output above.
i am interested in rows with src value of 90 or 59
the logic should be as follow
1. if there is a row with src value of 90 and another with src value of 59 then display the row withh src=90
2. if there is a row with src value of 90 but there is no row with value 59 then display the row with src=90
3. if there is a row with src value of 59 but there is no row with value 90 then display the row with src=59
4. if there is no row with src value 59 and/or 90, then dont display anything
so for a particular id, example 517, there is a row with src=90 and 59, so i want to display the one with src=90
in id 518, there is one row with src=90 but no row with src=59. display row with src=90
in 519, there is no row with src=90, but there is one with 59, display row with src=59
id 520 dont have rows with src 90 or 59, dont display anything
i want to join table1 and table2 together. in table2 i need to get the src value so that i can join with table1.
can somebody help write a query that gives me the output above? thanksI think this works for your 'new' logic.
WITH table1 AS
SELECT 517 the_id, 'TA33' cid, To_Date('1/1/2010','mm/dd/yyyy') dt, 90 src, 'MEDREC-C' the_name, 'FIN' lvl_1, 'FCS' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 517 the_id, 'TA33' cid, To_Date('1/1/2010','mm/dd/yyyy') dt, 88 src, 'MEDREC-L' the_name, 'FINA' lvl_1, 'FIC' lvl_2, ' BAN' lvl_3 FROM dual UNION all
SELECT 517 the_id, 'TA33' cid, To_Date('1/1/2010','mm/dd/yyyy') dt, 91 src, 'MEDREC-H' the_name, 'BA' lvl_1, 'BAING' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 517 the_id, 'TA33' cid, To_Date('1/1/2010','mm/dd/yyyy') dt, 59 src, 'MEDREC-R' the_name, 'FIN2' lvl_1, 'FCY' lvl_2, ' BANW' lvl_3 FROM dual UNION ALL
SELECT 517 the_id, 'TA33' cid, To_Date('1/5/2010','mm/dd/yyyy') dt, 90 src, 'MEDREC-C' the_name, 'FIN22' lvl_1, 'FCS22' lvl_2, ' BAN22' lvl_3 FROM dual UNION ALL
SELECT 517 the_id, 'TA33' cid, To_Date('1/5/2010','mm/dd/yyyy') dt, 88 src, 'MEDREC-L' the_name, 'FINA' lvl_1, 'FIC' lvl_2, ' BAN' lvl_3 FROM dual UNION all
SELECT 517 the_id, 'TA33' cid, To_Date('1/5/2010','mm/dd/yyyy') dt, 91 src, 'MEDREC-H' the_name, 'BA' lvl_1, 'BAING' lvl_2, ' BAN' lvl_3 FROM dual UNION ALL
SELECT 517 the_id, 'TA33' cid, To_Date('1/5/2010','mm/dd/yyyy') dt, 59 src, 'MEDREC-R' the_name, 'FIN2' lvl_1, 'FCY' lvl_2, ' BANW' lvl_3 FROM dual UNION ALL
SELECT 518 the_id, 'TA35' cid, To_Date('1/2/2010','mm/dd/yyyy') dt, 90 src, 'MEDREC-C' the_name, 'IND' lvl_1, 'IMAN' lvl_2, ' CO' lvl_3 FROM dual UNION all
SELECT 518 the_id, 'TA35' cid, To_Date('1/2/2010','mm/dd/yyyy') dt, 88 src, 'MEDREC-L' the_name, 'IND' lvl_1, 'CAP' lvl_2, ' CO' lvl_3 FROM dual UNION all
SELECT 518 the_id, 'TA35' cid, To_Date('1/2/2010','mm/dd/yyyy') dt, 91 src, 'MEDREC-H' the_name, 'EMAC' lvl_1, 'COG' lvl_2, ' CO' lvl_3 FROM dual UNION ALL
SELECT 519 the_id, 'TA23' cid, To_Date('1/3/2010','mm/dd/yyyy') dt, 59 src, 'MEDREC-R' the_name, 'UYS' lvl_1, 'TYU' lvl_2, ' CO' lvl_3 FROM dual UNION all
SELECT 519 the_id, 'TA33' cid, To_Date('1/3/2010','mm/dd/yyyy') dt, 88 src, 'MEDREC-L' the_name, 'UYS2' lvl_1, 'TYU2' lvl_2, ' CO2' lvl_3 FROM dual UNION ALL
SELECT 519 the_id, 'TA23' cid, To_Date('1/7/2010','mm/dd/yyyy') dt, 59 src, 'MEDREC-R' the_name, 'UYS66' lvl_1, 'TYU66' lvl_2, ' CO1' lvl_3 FROM dual UNION all
SELECT 519 the_id, 'TA33' cid, To_Date('1/7/2010','mm/dd/yyyy') dt, 88 src, 'MEDREC-L' the_name, 'UYS2' lvl_1, 'TYU2' lvl_2, ' CO2' lvl_3 FROM dual UNION ALL
SELECT 520 the_id, 'TA2' cid, To_Date('1/4/2010','mm/dd/yyyy') dt, 88 src, 'MEDREC-L' the_name, 'UYS6' lvl_1, 'TYU' lvl_2, ' CO' lvl_3 FROM dual
table2 AS
SELECT 90 src, 'YB' the_name FROM dual UNION ALL
SELECT 59 src, 'YC' the_name FROM dual UNION all
SELECT 91 src, 'BB' the_name FROM dual UNION ALL
SELECT 88 src, 'YI' the_name FROM dual
SELECT
results.the_id ,
results.cid ,
results.dt ,
results.src ,
results.the_name ,
results.lvl_1 ,
results.lvl_2 ,
results.lvl_3 ,
t2.the_name AS tab2_the_name
FROM
SELECT
the_id ,
cid ,
dt ,
src ,
the_name,
lvl_1 ,
lvl_2 ,
lvl_3 ,
CASE
WHEN src IN (59, 90)
THEN rank() over (partition BY the_id order by
CASE
WHEN src IN (59,90)
THEN src
ELSE -100
END DESC )
ELSE NULL
END AS rn
FROM
table1
results,
table2 t2
WHERE
results.src = t2.src
AND
rn = 1
OR rn IS NULL
THE_ID CID DT SRC THE_NAME LVL_1 LVL_2 LVL_3 TA
517 TA33 01-JAN-2010 12 00:00 90 MEDREC-C FIN FCS BAN YB
517 TA33 05-JAN-2010 12 00:00 90 MEDREC-C FIN22 FCS22 BAN22 YB
517 TA33 05-JAN-2010 12 00:00 91 MEDREC-H BA BAING BAN BB
517 TA33 05-JAN-2010 12 00:00 88 MEDREC-L FINA FIC BAN YI
517 TA33 01-JAN-2010 12 00:00 91 MEDREC-H BA BAING BAN BB
517 TA33 01-JAN-2010 12 00:00 88 MEDREC-L FINA FIC BAN YI
518 TA35 02-JAN-2010 12 00:00 90 MEDREC-C IND IMAN CO YB
518 TA35 02-JAN-2010 12 00:00 88 MEDREC-L IND CAP CO YI
518 TA35 02-JAN-2010 12 00:00 91 MEDREC-H EMAC COG CO BB
519 TA23 03-JAN-2010 12 00:00 59 MEDREC-R UYS TYU CO YC
519 TA23 07-JAN-2010 12 00:00 59 MEDREC-R UYS66 TYU66 CO1 YC
519 TA33 03-JAN-2010 12 00:00 88 MEDREC-L UYS2 TYU2 CO2 YI
519 TA33 07-JAN-2010 12 00:00 88 MEDREC-L UYS2 TYU2 CO2 YI
520 TA2 04-JAN-2010 12 00:00 88 MEDREC-L UYS6 TYU CO YI
14 rows selected.
Elapsed: 00:00:00.25
ME_XE? -
Measures and dates in a pivot table
I have a report that breaks out multiple metrics by quarter over a two year period. My issue arises when I add specific additional metrics to the report, the year and quarterly breakout gets thrown off. So instead of seeeing Qtrs 1-4 for lastyear and Qtrs 1 & 2 for this year, I now get only Qtrs 2, 3 & 4 for last year and 1 for this year. This new result set does not match up to any of the any of the qtrs on the orignal buckets before I added the additional metrics. I have tried setting the new metrics to "Server Determined" on the report end and viewing the report in a table format. I still get the same issue. Any help is appreciated?
It turns out that within the business model I needed to leverage physical source columns versus logical columns when building the new metric
-
Percentage of Total Count of Category in Raw Data Column in Pivot Table
I have normalized my data in Excel and I have a column: "question 1" and then a column for "gender" which has values as "female" and "male". I have created a pivot table for these two variables, "Gender" and
"Question 1". My values for Females and Males from the Gender data are presented within my pivot table. I want to present these numbers as percentages of Total "Females" and "Males" that are in the "Gender" column in
my master dataset. Pivot tables will only allow me to do %'s of data already in the pivot table
I am attempting to use Calculated Fields within Pivot Tables to resolve this. I do not want to create a separate column in my master data set, but rather, complete all calculations within the pivot tableThank you very much,
The steps you provided use the total "gender" within the pivot table as the "grand total".
If I have a binomial variable, "gender" with "male" as one of the variables, I need the grand total be the total male in the raw data.
Example: if there are 100 total males in the raw data for the column "gender"
and I construct a pivot table with a dependent variable which is a survey question and "gender" and 30 males "agreed" with the survey question and 20 females "agreed" with the survey question, your instructions for % of grand total would show 60% for
males who agree [males + females who replied to the survey question],
when, what I need is the total males in the raw data, 100, used as the total so that the percentage of males who answered "agreed" to the survey question is 30% of all males.
Thank you very much -
Adding Cumulative Percentages to Pivot table
Hi all,
I am trying to add a Cumulative Percentage to a pivot table in Hyperion IR 11:
Month joined July August September October
Sales 5 3 2 0
Accounts 2 1 0 1
Marketing 0 8 5 2The pivot facts are the number of employees joining the department and the row label is the department.
I am trying to add a running cumulative percentage in the pivot table for each month. Example, the cumulative percent in July will be 71.4% [5/(5+2)] under Sales department and 100% under Accounts department (71.4 + 28.6 of Accounts). For month of August, the cumulative percent will reset the calculation to be that it will be 25% [3/(3+1+8)] for Sales in August. The expected pivot table is something like that:
Month joined July August September October
Sales 71.4 25 28.5 0
Accounts 100 33.3 28.5 33
Marketing 100 100 100 100The underlying table is as follows:
Month joined Department No of employee
July Sales 5
July Accounts 2
July Marketing 0
August Sales 3
August Accounts 1
August Marketing 8
September Sales 2
September Accounts 0
September Marketing 5
October Sales 0
October Accounts 1
October Marketing 2I have tried using the Add Cume function but am not able to give the correct figure.
Has anybody had any suggestions on how to produce the cumulative percentage in the pivot?
Thanks in advance.Hover text is possible with static text but your requirement would not be possible to display value unless its hardcoded
-
How to calculate New customers and Returning customers in a Pivot Table?
Hi,
I have a Pivot table with columns as Order Date, Customer Name, Qty, Cost, Freight, Invoice, Adv Payment. I have only 30 customers and 11000 transactions for 4 years sales period.
How to calculate New customers and Returning customers in Pivot Table for any given Month or Quarter or Year. I am open to use helper column, formula or a calculated field etc
Thanks
ArjunHi Arjun,
I have received the file and read it, based on your further explain, I know your requested more clarity. In my view, the requested could be done via VBA code or Select function in other dataset, like Access/SQL. (Because before we count the new
customer and return customer, we might to filter them via rule, the formula need to assign the customer one by one. So, it's inefficient)
Thus, I recommend we try the above workaround: Use macro or Select function in Access. If you have further question about the coding, please post to the MSDN forum for Excel
http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
Select and update in same instruction
Can i select and update a column in table by one query only
I donot want to execute two queries one for updation and one for retrieval
e.g. instead of UPDATE t1 set val=val+1 and then SELECT val from t1;
i wanna have a single query (compliant to mysql and ORACLE)
because when i passa query UPDATE t1 set val=val+1; SELECT val from t1; on the command prompt is is fine but when i do so through jdbc it gives me errror
please helpWhy would a stored procedure change anything?
The stored procedure would have the UPDATE ... ; SELECT sequence in it.
Which results in the same "work" the database has to do, compared to sending the two statements via JDBC.
The only thing that a stored procedure would save, is the second JDBC call, but I doubt that this makes a big difference (provided this is not done in a loop. Then I'd retrieve the new values in one statement after all the updates have been committed)
So I would simply do Statement statement = connection.createStatement();
int rows = statement.executeUpdate("UPDATE ....");
ResultSet rs = statement.executeQuery("SELECT ... ");
String val = null;
if (rs.next()) val = rs.getString(1);
rs.close();The code for the stored procedure would look very similar to this with the disadvantage that that you have to maintain it for every DBMS that has to be supported. -
Implementing Pivot Table like functionality using SQL
Dear All,
Please access a online document:
http://docs.google.com/View?docid=dhntd3vh_0gmwgmq
A 'query-output' is given.
I have pasted this output in Excel and using it's Pivot table feature
obtained an output given as 'Expected-Output' in the document.
How can I achieve this using SQL?
Any guidelines are most welcome.
-SameerSee if this implementation could satisfy your needings.
CREATE THE A TABLE WITH ESSENTIAL INFORMATION
CREATE TABLE THINGS (
WHO VARCHAR2(32) NOT NULL,
WHAT VARCHAR2(32) NOT NULL,
NUM NUMBER
FILLING THE ESSENTIAL INFORMATION
INSERT INTO THINGS VALUES ('AFAS','TRANSACTION',4);
INSERT INTO THINGS VALUES ('FAS-AP','TRANSACTION',2);
INSERT INTO THINGS VALUES ('FAS-AR','TRANSACTION',2);
INSERT INTO THINGS VALUES ('FAS-GL','MASTER',3);
INSERT INTO THINGS VALUES ('FAS-GL','REPORT',5);
INSERT INTO THINGS VALUES ('INTERNATIONAL CARGO','MASTER',1);
INSERT INTO THINGS VALUES ('INTERNATIONAL CARGO','REPORT',2);
INSERT INTO THINGS VALUES ('INTERNATIONAL CARGO','TRANSACTION',9);
INSERT INTO THINGS VALUES ('PACKAGE EXPRESS','INTELLIVIEW REPORT',1);
INSERT INTO THINGS VALUES ('PACKAGE EXPRESS','MASTER',4);
INSERT INTO THINGS VALUES ('PACKAGE EXPRESS','TRANSACTION',76);
INSERT INTO THINGS VALUES ('PACKAGE EXPRESS','UTILITIES',1);
INSERT INTO THINGS VALUES ('WAREHOUSE','REPORT',1);
INSERT INTO THINGS VALUES ('WAREHOUSE','TRANSACTION',9);
CREATE A TABLE FOR THE FULL CORRISPONDENCE
CREATE TABLE THINGS2 AS
SELECT A.WHO,B.WHAT, 0 NUM
FROM (
SELECT DISTINCT WHO
FROM THINGS
) A, (
SELECT DISTINCT WHAT
FROM THINGS
)B;
SET THE RIGHT VALUES ON EACH ROW
UPDATE THINGS2 A
SET NUM = (
SELECT NVL(SUM(NUM),0)
FROM THINGS B
WHERE ( A.WHO = B.WHO )
AND ( A.WHAT = B.WHAT )
SHOW THE FULL TABLE ( FULL BECAUSE IT CONTAINS THE FULL JOIN BETWEEN "WHO" AND "WHAT" )
SELECT *
FROM THINGS2
RETRIVE THE EXPECTED OUTPUT
SELECT A.WHO,"TRANSACTION","MASTER","INTELLIVIEW REPORT","UTILITIES"
FROM (
SELECT WHO,NUM "TRANSACTION"
FROM THINGS2
WHERE WHAT = 'TRANSACTION'
) A,(
SELECT WHO,NUM "MASTER"
FROM THINGS2
WHERE WHAT = 'MASTER'
) B,(
SELECT WHO,NUM "REPORT"
FROM THINGS2
WHERE WHAT = 'REPORT'
) C,(
SELECT WHO,NUM "INTELLIVIEW REPORT"
FROM THINGS2
WHERE WHAT = 'INTELLIVIEW REPORT'
) D,(
SELECT WHO,NUM "UTILITIES"
FROM THINGS2
WHERE WHAT = 'UTILITIES'
) E
WHERE ( A.WHO = B.WHO )
AND ( A.WHO = C.WHO )
AND ( A.WHO = D.WHO )
AND ( A.WHO = E.WHO );
Ps.
Could anybody tell me how is it possible to indent text on the board of this forum?
Bye Alessandro -
Export Pivot table data to a Excel file
Hi All,
I am using OBIEE 10.1.3.
In my asnwers I am displaying the Pivot view and want to export the results to a excel sheet.The dowlnoad option is not coming for Pivit view.
In case of compound view I am able to see the download option to export to excel sheet.
Please suggest.
thanksThe Compound Layout has a purpose and that is to display your report with the download optons you can "turn on," including "download to Excel." To answer your question of somehow enabling a "download link" from the Pivot Table view, sorry, you can't do that. However, here's what you can do:
In Answers, use the Compound Layout view to download the pivot table. If the Compound Layout view is used for other purposes and you need only the pivot table view to download (as a report designer) and you really need this functionality, then create a duplicate of the Compound Layout and put only your pivot table in it. Now you can download.
If you are talking about dashboards, then use the Properties>Report Links from the Properties button of the report and check off "download." Again, if your Compound Layout is used for other purposes (and requires other views in it), then drag the report into another section of the dashboard and in Edit Dashobard, click on the Properties of the report>Show View>Compound Layout:2 that you created in the previous paragraph. Enable downloading on this and you can download only the Pivot table.
Maybe you are looking for
-
ITunes Store - Network Connection Reset
Greetings, I have now been unable to connect to the iTunes Store for the last couple of days now but have been able to previously download apps etc. Now I continuously get the error message: "iTunes could not connect to the iTunes Store. The network
-
External Harddrive Recognized...but not
Hey all, I'm having some real problems here and I'm wondering if my HD is dead. I have probably 100Gb of music and 250Gb of pictures and movies and such, and would be devastated if I lost it all. When I plug in the HD, it boots up and turns on, and m
-
Cannot establish connection - JDBC driver for MS SQL server 2000
Hi, We are facing problems in connecting to SQL server 2000. We have installed the latest version of the driver from followin link and following https://websmp108.sap-ag.de/msplatforms > SQL Server > JDBC Driver for MS SQL Server (Version 3.70.10)
-
Mac OS X 10.6 snow leopard
now, when it does come out, should i upgrade to it, i have read that its not a necessity but will only make things faster and better but nothing new really...is this true? if not can you just tell me what exactly its going to do differently. i know t
-
Auto-stack by capture time not correct
Hi, I have 28 photographs taken sequentialy but not at same intervals; they are part of a collection. I proceed to select all of them and choose "Stacking-Auto stack by capture time..." from the context menu and choose time between stacks as 0:01:00