Crosstab query is it possible in BEX?
Hi
I am working with the Marketing attributes ODS 0ATR_DS01 and I want a query that has the partner in rows with the attribute name in columns showing the attribute values i.e. a crosstab query.
I've been playing with BEx trying to create a crosstab query - something I thought should be very straight forward but I just don't seem to be able to get it to work. I searched the forums for Crosstab and don't get any hits, has anyone tried to create a crosstab - is it possible with BW - if so please point me in the right direction.
Regards
Gareth
Hi,
Make the<i> Attribute</i> the navigational attribute.
Then you can take Partner in rows and <i>attribute</i> in columns.
With rgds,
Anil Kumar Sharma .P
Similar Messages
-
Is it possible to do perform data entry in a crosstab query view?
If you want to insert, update or delete in a view you need to write ON-INSERT, ON-UPDATE and/or ON-DELETE trigger and perform your DML inside these triggers ...
Hope it helps
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by JAMIE MCPHIE ([email protected]):
Is it possible to do perform data entry in a crosstab query view?<HR></BLOCKQUOTE>
null -
Dear members:
I have been trying to generate a crosstab query in Oracle using SQL.
This is the situation:
I have two tables in Oracle. One contains characteristics of institutions which people visit, and includes, amongst other fields, the ID of the institution (number) and an identificator for the district where the institution is implanted (number; ranging 1 - 18).
The second table also contains a field with the ID of the institution, and more: the date when the visit occured (date), and a sequential (unique) number for each visit.
What I need to obtain is a final table containing the following fields:
Date of the visit, total number of visitors per date of visit, and a field for each district containing the total number of visitors to instituitions of the district per each date of visit.
Can anyone give me a hint on this?
Also; is there a user-frindly interface minimizing the use of SQL that I can download from Oracle for generating this?
Thank You
AndréCrosstab is a reporting function not a SQL one. SQL statements must have a fixed number of columns regardless of the data.
The only way to do it using SQL is to use PL/SQL to generate a dynamic query as shown on Ask Tom here
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:15151874723724
Otherwise there are reporting tools such as Oracle Reports that can do it as well. -
Format Column Header in Crosstab Query in Crystal Reports for Enterprise
Hi
I am using Crystal reports for Enterprise and I would like to format the Column header of a crosstab query one block of colour say light blue. However I cannot select the header in isolation to the rest of the cross tab. All I can select is either column text boxes, which doesnu2019t look good formatted as a different colour to the background of the crosstab. Or I can only select either entire column or the entire row, which kind of defeats the object of formatting just the column header itself. Is there a way to isolate the column headers so I can format just the header, as the report is looking extremely bland all in white?
Many Thanks in advance
Regards
NeilAlright, here's what you need to do:
1) RIght-click one of the Column Headers and select 'Format Result Object Element' > Appearance > click on the formula button (fx) beside 'Fill' and use this code:
if currentrowindex < 0 then crBlue
You wanted light blue right? So, the rgb value for light blue or sky blue would be 135-206-250. So, you can change the color by modifying the formula like this:
if currentrowindex < 0 then color(135,206,250)
If this is not the exact blue you're after, just google!
Hope this helps!
-Abhilash -
Custom column in Crosstab query in BO 6.5
Hello Gurus,
I am trying to create a report in BO 6.5 using data from two flat files by linking them and I applied cross-tab template as I need row data as columns based on a field called STATUS (Approved, Cancelled, In process etc). And in this STATUS field I want to add another column (Not Ordered) on the run using some conditions which is not in the flatfile. How can I do that?
Please let me know if my post in unclear so that I can provide more data regarding the report.
Thanks in advance for your time.Let me elaborate my requirement. I am trying to create a report using data from two flat files. I am supposed to give the status of orders. So I created crosstab query and I chose STATUS field data to be as columns. Currently it have three fields----Approved, In process, Waiting for approval. Now as per requirement I am supposed to include another column called Not applicable based on two fields Amount and Local/No local. Before this we used to create the same report uising excel and I used below formula:
=IF(AND(Amount=0,B2="Non-Local"),"Not Applicable","Approved")
But in BO if the above condition is False I want that particular record to fall under already existing "Approved" but it is creating another "Approved" status and it is not catagorizing Not applicable....I mean every record with amount =0 falls under new Approved status but not in Not applicable as expected. Hope you understand my issue.
Am i doing anything wrong in creating formula? -
Display Crosstab query in DataGrid
Hi, I'm a Flex beginner. Could someone please help me how to
display crosstab query result in DataGrid? The following query
returns 6 columns:
- First column: values in the field Sell_Channel
- Second: Sum(Revenue Total) from the Revenue field.
- Others: Revenue Subtotal by Sell_Channel and quarter.
Quarters are values stored in the field name Quarter. In Datagrid,
what would be the datafield for these 4 quarter columns?
Thanks millions.
Here is my SQL:
TRANSFORM Sum(Revenue.RevenueTotal) AS SumOfRevenueTotal
SELECT Revenue.Sell_Channel, Sum(Revenue.RevenueTotal) AS
[Total Of RevenueTotal]
FROM Quarter INNER JOIN Revenue ON Quarter.FiscalQuarter =
Revenue.Quarter
WHERE (Revenue.Fiscal_Year="2006")
GROUP BY Revenue.Sell_Channel
PIVOT Quarter.Quarter;Crosstab is a reporting function not a SQL one. SQL statements must have a fixed number of columns regardless of the data.
The only way to do it using SQL is to use PL/SQL to generate a dynamic query as shown on Ask Tom here
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:15151874723724
Otherwise there are reporting tools such as Oracle Reports that can do it as well. -
Bex Query is working fine in Bex Analyzer but in Webi 4.0 its not.
Hi guys,
I am using Bex Query as a datasrouce for a Interactive Analysis 4.o. but its giving me the following error below:
Note: i can use other Bex Queries just fine in interactive analysis, and this problomatic query is working fine in Bex Analyzer.
" The DSL Service returned an error: com.businessobjects.mds.services.helpers.OlapUniverseHelper$DimensionsFromCubeFailedException: Cannot retrieve dimensions from cube Commercial Margin
at com.businessobjects.mds.services.helpers.OlapUniverseHelper.createSapBusinessLayer(OlapUniverseHelper.java:428)
at com.businessobjects.mds.services.helpers.OlapUniverseHelper.createBusinessLayer(OlapUniverseHelper.java:246)
at com.businessobjects.dsl.services.datasource.impl.AbstractOlapUniverseProvider.createOlapUniverse(AbstractOlapUniverseProvider.java:62)
at com.businessobjects.dsl.services.datasource.impl.DirectOlapAccessUniverseProvider.createOlapUniverse(DirectOlapAccessUniverseProvider.java:94)
at com.businessobjects.dsl.services.datasource.impl.DirectOlapAccessUniverseProvider.provideUniverseFromInlineResource(DirectOlapAccessUniverseProvider.java:82)
at com.businessobjects.dsl.services.datasource.impl.AbstractUniverseProvider.provideUniverse(AbstractUniverseProvider.java:48)
at com.businessobjects.dsl.services.universe.impl.AbstractUniverseService.provideUniverse(AbstractUniverseService.java:82)"
Sheikh Hassan AyubHi,
There has been some escalation with regards to similar problem with the early version of BI 4.x.
I would advise you to download the latest version and latest patch in your QA environment and do some testing with the same query.
Regards
Steph -
Hi
Question:
In a hierarchical query, is it possible for a row to have more than one immediate ancestor?
Answer:
No
No? Surely, it's yes?
Thanks,
JasonAs Frank pointed out already hierarhical most often means a tree (data structure) to deal with.
There must usually be just one boss (the root) in which case the answer is no.
Something to read: http://en.wikipedia.org/wiki/Tree_(data_structure)
You can find out Solomon spoke about a generalization therein.
Related to forum troubles:
If I login first thing after reaching forum, the behaviour is rather consistent - I'm allowed to post answers, otherwise ...
Regards
Etbin -
Use for a Crosstab Query?
I have a table with the following metric data in it.
one entry for a metric, whether its integrity was checked and the date checked.
I need a report that puts all monthly activity on a single line.
Examples:
Here's what the table looks like
proj_name metric integrity_checked Date
abc broke Y 01-Apr-08
abc fixed Y 01-Apr-08
abc trashed Y 01-Apr-08
abc broke Y 01-Mar-08
abc fixed Y 01-Mar-08
abc trashed Y 01-Mar-08
xyz broke Y 01-Apr-08
yxz fixed Y 01-Apr-08
yxz trashed Y 01-Apr-08
yxz broke Y 01-Mar-08
yxz fixed Y 01-Mar-08
yxz trashed Y 01-Mar-08
Report needs to look like this.
Prog Metric Apr-08 Mar-08
abc broke Y Y
abc fixed Y Y
abc trashed Y Y
xyx broke Y Y
xyz fixed Y Y
xyz trashed Y Y
Does this call for a crosstab-type query and if so
how would I code it?
I've done one crosstab query before but can't get this one to come out right.
Thanks
DavidSee this link
http://www.myoracleguide.com/s/Pivot_Tables.htm -
Crosstab Query for Remaining Revenue (Count, If, Date Between )
Hi all, hope you had a great new year.
I am wanting to create a crosstab query for my Projects which shows ProjectID in the row headers and Time Periods split into months quarter or year as the Column Headers using the [DateAgreed] from the Session table.
I have created crosstabs which show revenue from sessions and count of sessions with different time periods but i am trying to make it so that it counts only completed sessions from before the column date, so that i can then multiply by the [SessionCost].
Any ideas guys?
Here's what i have been working with;
TRANSFORM Sum(([tblSession]![SessionCompleted]*[tblProject]![SessionCost])) AS Revenue
SELECT tblProject.ProjectID, tblCompany.CompanyName
FROM (tblSession INNER JOIN tblCompany ON tblSession.CompanyID = tblCompany.CompanyID) INNER JOIN ((tblProject INNER JOIN tblProjectMetrics ON tblProject.ProjectID = tblProjectMetrics.ProjectID) INNER JOIN qryProjectStatus ON tblProject.ProjectID = qryProjectStatus.ProjectID)
ON (tblProject.ProjectID = tblSession.ProjectID) AND (tblCompany.CompanyID = tblProject.CompanyID)
GROUP BY tblProject.ProjectID, tblCompany.CompanyName, tblProject.Total
PIVOT Format([DateAgreed],"yyyy-mm");
Thanks :)Hi Gord0oo,
You could concatenates the data as a result and show in a cell.
TRANSFORM Sum([tblProject]![SessionCost])) & ";" & Sum([tblSession]![SessionCompleted]) AS Revenue
Regards
Starain
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Is there Oracle Crosstab query like access?
Hi,
Shirani wrote:
... Any idea to diplay data in this format using ASP Classic Code.. but connectivity with Oracle DB?Sorry, I don't know anything about ASP.
If the problem is that ASP needs to know how many columns the dynamic query will be returning, then perhaps you can do something on the ASP side like the preliminary query.
Another approach would be not to return separate columns, but to concatenate the pivoted results into one huge VARCHAR2 column, with the columns delimied as in a csv file. This might be simpler on the Oracle side; you can do String Aggregation without dynamic SQL. Your ASP application could then parse the huge VARCHAR2 to get the individual parts. -
Hi
I'd like to create a crosstab query but I'm not sure what function to use to do it.
MSAccess has 'Transform' but what do I use in Oracle SQL?
Does anyone have any examples or references to look at? ThanksWoof,
Here's an example. If you are running Oracle 11, then Pivot is also available.
SELECT state,
round( sum( mens ), 2 ) "Mens",
round( sum( womens ), 0 ) "Womens",
round( sum( accessories ), 0 ) "Accessories"
FROM ( SELECT demo_customers.cust_state state,
CASE
WHEN demo_product_info.category = 'Mens'
THEN
demo_order_items.quantity * demo_order_items.unit_price
ELSE
0
END
mens,
CASE
WHEN demo_product_info.category = 'Womens'
THEN
demo_order_items.quantity * demo_order_items.unit_price
ELSE
0
END
womens,
CASE
WHEN demo_product_info.category = 'Accessories'
THEN
demo_order_items.quantity * demo_order_items.unit_price
ELSE
0
END
accessories
FROM demo_order_items,
demo_product_info,
demo_customers,
demo_orders
WHERE demo_order_items.product_id = demo_product_info.product_id
AND demo_order_items.order_id = demo_orders.order_id
AND demo_orders.customer_id = demo_customers.customer_id )
GROUP BY ROLLUP( state )Jeff -
Crosstab query using pure SQL only
Hi all,
Found a lot of threads on crosstab, but none seems to address what I need. I need to perform crosstab query using pure SQL only & the number of columns are dynamic. From a query, I obtained the below table:
Name Date Amount
Alex 2005-06-10 1000
Alex 2005-06-20 1000
Alex 2005-07-10 1000
Alex 2005-07-20 1000
Alex 2005-08-10 1000
Alex 2005-08-20 1000
John 2005-06-10 2000
John 2005-06-20 2000
John 2005-07-10 2000
John 2005-07-20 2000
John 2005-08-10 2000
John 2005-08-20 2000
And I need to transform it into:
Name 06-2005 07-2005 08-2005
Alex 2000 2000 2000
John 4000 4000 4000
Reason for the columns being dynamic is because they'll be a limit on the date ranges to select the data from. I'd have a lower & upper bound date say June-2005 to August-2005, which explains how I got the data from the above table.
Please advise.
Thanks!Hi,
I couldn't resist the intellectual challenge of a pure SQL solution for a pivot table with a dynamic number of columns. As Laurent pointed out, a SQL query can only have a fixed number of columns. You can fake a dynamic number of columns, though, by selecting a single column containing data at fixed positions.
<br>
<br>
If it were me, I'd use a PL/SQL solution, but if you must have a pure SQL solution, here is an admittedly gruesome one. It shows the sum of all EMP salaries per department over a date range defined by start and end date parameters (which I've hardcoded for simplicity). Perhaps some of the techniques demonstrated may help you in your situation.
<br>
<br>
set echo off
set heading on
set linesize 100
<br>
select version from v$instance ;
<br>
set heading off
<br>
column sort_order noprint
column sal_sums format a80
<br>
select -- header row
1 as sort_order,
'DEPTNO' as DEPTNO ,
sys_connect_by_path
( rpad
( to_char(month_column),
10
' | '
) as sal_sums
from
select
add_months( first_month, level - 1 ) as month_column
from
( select
date '1981-01-01' as first_month,
date '1981-03-01' as last_month,
months_between( date '1981-03-01', date '1981-01-01' ) + 1 total_months
from dual
connect by level < total_months + 1
) months
where
connect_by_isleaf = 1
connect by
month_column = add_months( prior month_column, 1 )
start with
month_column = date '1981-01-01'
union all
select -- data rows
2 as sort_order,
deptno,
sys_connect_by_path( sum_sal, ' | ' ) sal_sums
from
select
dept_months.deptno,
dept_months.month_column,
rpad( to_char( nvl( sum( emp.sal ), 0 ) ), 10 ) sum_sal
from
select
dept.deptno,
reporting_months.month_column
from
dept,
( select
add_months( first_month, level - 1 ) as month_column
from
( select
date '1981-01-01' as first_month,
date '1981-03-01' as last_month,
months_between( date '1981-03-01', date '1981-01-01' ) + 1 total_months
from
dual
connect by level < total_months + 1
) reporting_months
) dept_months,
emp
where
dept_months.deptno = emp.deptno (+) and
dept_months.month_column = trunc( emp.hiredate (+), 'MONTH' )
group by
dept_months.deptno,
dept_months.month_column
) dept_months_sal
where
month_column = date '1981-03-01'
connect by
deptno = prior deptno and
month_column = add_months( prior month_column, 1 )
start with
month_column = date '1981-01-01'
order by
1, 2
<br>
VERSION
10.1.0.3.0
<br>
DEPTNO | 81-01-01 | 81-02-01 | 81-03-01
10 | 0 | 0 | 0
20 | 0 | 0 | 0
30 | 0 | 2850 | 0
40 | 0 | 0 | 0
<br>
Now, if we substitute '1981-03-01' with '1981-06-01', we see 7 columns instead of 4
<br>
DEPTNO | 81-01-01 | 81-02-01 | 81-03-01 | 81-04-01 | 81-05-01 | 81-06-01
10 | 0 | 0 | 0 | 0 | 0 | 2450
20 | 0 | 0 | 0 | 2975 | 0 | 0
30 | 0 | 2850 | 0 | 0 | 2850 | 0
40 | 0 | 0 | 0 | 0 | 0 | 0
<br>To understand the solution, start by running the innermost subquery by itself and then work your way outward. -
I've created the below crosstab query for a report.
Select Grouping_Condition,Warehouse,Max(Value) Over (Partition By Grouping_Condition,Warehouse) As Total,
Sum(Value) Over (Partition By Warehouse) As Total_Containers_Per_Warehouse,
Sum(Vat1Ue) Over () As Total_Containers,
(Max(Vat1Ue) Over (Partition By Grouping_Condition,Warehouse))
/(Sum(Vat1Ue) Over (Partition By Warehouse))*100 As Total_Pct
From
Seleect Grouping_Condition,Warehouse,Count(*) As Value
From
Set1Ect
T1.Warehouse,Shipped_Weight As Shipped_Tons,T1.Max_Weight As Maxtonnes,
Case When (Shipped_Weight)< (T1.Max_Weight*0.001)*0.95 Then 'containers_under_95'
When (Shipped_Weight*0.001) Between (T1.Max_Weight*0.001)*0.95 And (T1.Max_Weight*0.001) Then 'containers_95_100'
Et1Se 'containers_above_weight'
End Grouping_Condition
From
Tabt1E1 T1
,Tabt1E2 T2
,Tabt1E3 C
Where
T1.Co11 = T2.Col1
And T1.Col2=C.Col2
And More Conditions
Where Warehouse In ('W1','W2','W3','W4','W5')
Group By (Grouping_Condition,Warehouse)
The Above Query Gives Me Output Something Like Below:
Grouping_Condition Warehouse Total Total_Containers_Per_Warehouse Total_Containers Total_Pct
Containers_95_100 W1 5 10 60 50
Containers_Under_95 W1 5 10 60 50
Containers_95_100 W2 10 20 60 50
I've Got Report In The Below Format
W1 W2 W3 W4 W5 Total
Total_Containers 10 20 60
Containers_95_100 5 10 15
Containes_95_100_% 50 50 ????
I Need To Calculate The Total Percentage In The Above Table With ????
Any Help Is Much Appreciated..It appears as though you already have your groupings and counts per grouping, but require a ratio of each groupings count against all other counts. Is that correct ?
If so, try the new 11g analytic function, something like this:
select Grouping_Condition
,Warehouse
,ratio_to_report(Value) over () as Count_Ratio_over_Report
.. -
Is this possible? Crosstab query
Hi All,
I have a rather complicated requirement am trying to fulfill. I'll make it simple and leave unnecessary details out. I have a table with structure similar to shown below.
DECLARE @Trans TABLE (
trans_year int NULL,
customer_name nvarchar(100) NULL,
Amount FLOAT,
Quantity FLOAT)
INSERT INTO @Trans VALUES (2010, 'ABC', 100, 200)
INSERT INTO @Trans VALUES (2011, 'ABC', 200, 100)
INSERT INTO @Trans VALUES (2012, 'ABC', 500, 100)
INSERT INTO @Trans VALUES (2013, 'ABC', 400, 700)
INSERT INTO @Trans VALUES (2014, 'ABC', 600, 800)
SELECT * FROM @Trans
What I am trying to do is, for each customer, get all the amounts across by year. And for each year, I need to add a field that can show the total
until that year(sort of like YTD). This code will be executed in a stored procedure and the stored procedure has two parameters called start_year and end_year. For the first year provided as the parameter, we don't need the Total column as
it is going to be same as the amount for that year. Also, the quantity column is going to act like a normal column(not shown in the desired output below) and can be ignored for our discussion. Below is how the output needs to be.
Can someone please help? Thanks in advance!!
Cust
2010
2011
Total
2012
Total
2013
Total
2014
Total
ABC
100
200
300
500
800
400
1200
600
1800Well, to fix your immediate problem you needed to use correct variable in the loop (@year).
So, this is your code corrected
CREATE TABLE #Trans (
trans_year INT NULL
,customer_name NVARCHAR(100) NULL
,Amount FLOAT
,Quantity FLOAT
INSERT INTO #Trans
VALUES (
2010
,'ABC'
,100
,200
INSERT INTO #Trans
VALUES (
2011
,'ABC'
,200
,100
INSERT INTO #Trans
VALUES (
2012
,'ABC'
,500
,100
INSERT INTO #Trans
VALUES (
2013
,'ABC'
,400
,700
INSERT INTO #Trans
VALUES (
2014
,'ABC'
,600
,800
DECLARE @StartYear INT
,@EndYear INT;
SELECT @StartYear = MIN(trans_year)
,@EndYear = MAX(trans_year)
FROM #Trans;
DECLARE @Columns NVARCHAR(max)
,@Year INT;
SET @Columns = '';
SET @Year = @StartYear
WHILE @Year <= @EndYear
BEGIN
SET @Columns = @Columns + ', ' + quotename(cast(@year AS NVARCHAR(max)))
SET @Year = @Year + 1;
END
SET @Columns = STUFF(@Columns, 1, 2, '');
DECLARE @SQL NVARCHAR(max);
SET @SQL = ';WITH CTE AS (SELECT trans_year, customer_name, Amount FROM #Trans
WHERE trans_year >= @StartYear and trans_year < @EndYear)
SELECT * FROM CTE PIVOT (SUM(Amount) FOR trans_year IN (' + @Columns + ')) pvt'
--print @SQL;
EXECUTE sp_ExecuteSQL @SQL
,N'@StartYear INT, @EndYear INT'
,@StartYear
,@EndYear
DROP TABLE #Trans
However, this is not exactly what I had in mind for your case. In your case since you wanted to add Total columns in between I proposed to use slightly different approach of using CASE expressions and GROUP BY.
Will you be able to figure this out now or you need the solution spelled out?
For every expert, there is an equal and opposite expert. - Becker's Law
My blog
My TechNet articles
Maybe you are looking for
-
i just bought a macbook air. ive been transfering all my songs from my external harddrive that i had on my previous laptop for itunes. now that i got them transfered. my itunes wont open. it says "the itunes library file cannot be found or created. t
-
How in the world does Apple market the iPod, etc... as if 10-year olds and grandmothers can operate the technology, when having viewed these message boards for 10 hours yesterday, it seems as even the tech savy people who can make a computer out of t
-
hi i am constructing an interface and i need to use the ItemListener for my radio buttons. when i add this to the code and do a test compile it gives me the following error: F:\My Documents\Work\Uni\CNE1\Java\Semester 2\Remidial Assignment\Buttons>ja
-
Apple refuses to accept my serial number for the MacBook Bottom Case Replacement Program?
I bought my MacBook in September of 2011, but was told it was an early 2011 model. Just a little while ago, one of the rubber feet on the bottom fell off. Then another one. I decided against going with knock-off rubber feet in case they damaged the c
-
I just transferred my iTunes library from an old iMac G5 to a new MacBook Pro. Everything seems to be working OK, but... the window that displays album artwork in the lower left corner (i.e. "Display Selected Item") has vanished. How can I get it bac