Help on Dense Rank Function
Hello All,
Below is the sql i am trying to execute and the Dense Rank function is giving same result for all of the rows, could you please help me where i am doing wrong
SELECT
AMT,
DENSE_RANK() OVER (PARTITION BY AMT ORDER BY AMT DESC) AS DENSE_RANK
FROM
SELECT DISTINCT
SUM(NVL(TRUNC(NET_AMT) * NVL(GLOBAL1_EXCHANGE_RATE,1),0))
OVER (PARTITION BY CUSTOMER_BILL_TO_LOC_WID ORDER BY CUSTOMER_BILL_TO_LOC_WID)
AS AMT
FROM
W_SALES_BOOKING_LINE_F
WHERE
SALES_ORDER_NUM IN ('10612426','10612450','10612477','32649203')
AND
X_MONTH_WID=TO_CHAR(SYSDATE-1,'YYYYMMDD')
)--ORDER BY AMT DESC Result Set:
AMT DENSE_RANK
0 1
2,855 1
6,706 1
14,265 1
you have "broken" up your resultset (from the inline view) by AMT (PARTITION BY AMT)
and per part, you sort this (one row in each partition, not a whole lot of sorting) ( ORDER BY AMT DESC)
then you assign a ranking based on the sorting action... which yields 1 (DENSE_RANK)
Are you looking for this
SELECT
AMT,
DENSE_RANK() OVER (ORDER BY AMT DESC) AS DENSE_RANK
FROM
SELECT DISTINCT
SUM(NVL(TRUNC(NET_AMT) * NVL(GLOBAL1_EXCHANGE_RATE,1),0))
OVER (PARTITION BY CUSTOMER_BILL_TO_LOC_WID ORDER BY CUSTOMER_BILL_TO_LOC_WID)
AS AMT
FROM
W_SALES_BOOKING_LINE_F
WHERE
SALES_ORDER_NUM IN ('10612426','10612450','10612477','32649203')
AND
X_MONTH_WID=TO_CHAR(SYSDATE-1,'YYYYMMDD')
)--ORDER BY AMT DESC
Similar Messages
-
Hello,
I am using ORACLE 10g and having an error when updating a table and generating ORA-30926 'Unable to get a stable set of rows in the source tables'.
I create a temporary working table with records pulled from 2 different tables. The query to make the temp table uses
the DENSE RANK FUNCTION to eliminate any duplicates. But, I am still getting duplicate records.
When it is time to update my primary table with the records from the temp table, it sees the duplicates and
generates the error. I have all the code to create the problem. I think I almost have it but maybe need different query structure.Any help is appreciated.
-- Create table
create table CUSTOMER
EMP_ID NUMBER(4) ,
CUST_ID NUMBER(9) not null,
CONTACT_CD VARCHAR2(1),
PURCHASE_DATE DATE,
NEW_CUST_CD VARCHAR2(1),
CUST_NAME VARCHAR2(25)
-- Create table
create table DEFERRED_MAILING
CUST_ID NUMBER(9) not null,
EMP_ID NUMBER(4) not null,
PURCHASE_DATE DATE
insert into customer ( emp_id, cust_id, contact_cd,PURCHASE_DATE, NEW_CUST_CD,cust_name)
values (10,444,'Y',to_date('11-01-2011 16:11:05', 'dd-mm-yyyy hh24:mi:ss'),'Y','J.J.BROWN');
insert into customer ( emp_id, cust_id,contact_cd, PURCHASE_DATE, NEW_CUST_CD,cust_name)
values (10,444,'Y',to_date('11-01-2011 16:11:05', 'dd-mm-yyyy hh24:mi:ss'),'Y','J.BROWN');
insert into deferred_mailing (cust_id, emp_id, purchase_date)
values (444, 10, to_date('11-01-2011 16:11:05', 'dd-mm-yyyy hh24:mi:ss'));
create table UPDTE_DEFERRED_MAILING_RECORDS nologging as
SELECT a.CUST_ID,
a.EMP_ID,
a.PURCHASE_DATE,
a.DM_ROW_ID,
a.drank,
c.CONTACT_CD,
c.NEW_CUST_CD/*,
TRANS_ID_SEQ.NEXTVAL as TRANS_ID*/
FROM (SELECT a.ROWID AS DM_ROW_ID,
a.CUST_ID,
a.EMP_ID,
a.PURCHASE_DATE,
dense_rank() over(PARTITION BY a.CUST_ID, a.EMP_ID ORDER
BY a.PURCHASE_DATE DESC, a.ROWID) DRANK
FROM deferred_mailing a) a,
customer c
WHERE a.CUST_ID = c.CUST_ID
AND a.EMP_ID = c.EMP_ID
AND (a.PURCHASE_DATE <= c.PURCHASE_DATE OR
c.PURCHASE_DATE IS NULL);
SELECT * FROM UPDTE_DEFERRED_MAILING_RECORDS;
}Please try this
create table UPDTE_DEFERRED_MAILING_RECORDS nologging as
SELECT distinct a.CUST_ID,
a.EMP_ID,
a.PURCHASE_DATE,
a.drank,
c.CONTACT_CD,
c.NEW_CUST_CD,
a.DM_ROW_ID
FROM (SELECT a.ROWID AS DM_ROW_ID,
a.CUST_ID,
a.EMP_ID,
a.PURCHASE_DATE,
dense_rank() over(PARTITION BY a.CUST_ID, a.EMP_ID ORDER
BY a.PURCHASE_DATE DESC, a.ROWID) DRANK
FROM deferred_mailing a) a,
customer c
WHERE a.CUST_ID = c.CUST_ID
AND a.EMP_ID = c.EMP_ID
AND (a.PURCHASE_DATE <= c.PURCHASE_DATE OR
c.PURCHASE_DATE IS NULL)
and a.drank=1;
The query you've posted is behaving according to the expectations. The inner select is returning one row and the outer is returning two as the
WHERE a.CUST_ID = c.CUST_ID
AND a.EMP_ID = c.EMP_ID
AND (a.PURCHASE_DATE <= c.PURCHASE_DATE OR
c.PURCHASE_DATE IS NULL)
conditions are seeing two rows in the table customer.
I've added the a.drank=1 clause to skip the duplicates from the inner table and distinct in the final result to remove duplicates from the overall query result.
For eg, if you have one more row in the deferred_mailing like this
SQL> select * from DEFERRED_MAILING;
CUST_ID EMP_ID PURCHASE_
444 10 11-JAN-11
444 10 11-JAN-11
then the query without "a.drank=1" will return 4 rows like this by the outer query.
CUST_ID EMP_ID PURCHASE_ DM_ROW_ID DRANK C N
444 10 11-JAN-11 AAATi2AAGAAAACcAAB 2 Y Y
444 10 11-JAN-11 AAATi2AAGAAAACcAAA 1 Y Y
444 10 11-JAN-11 AAATi2AAGAAAACcAAB 2 Y Y
444 10 11-JAN-11 AAATi2AAGAAAACcAAA 1 Y Y
It'll return the below even if we use distinct on the same query(i.e. without a.drank=1)
CUST_ID EMP_ID PURCHASE_ DM_ROW_ID DRANK C N
444 10 11-JAN-11 AAATi2AAGAAAACcAAB 2 Y Y
444 10 11-JAN-11 AAATi2AAGAAAACcAAA 1 Y Y
which contains duplicates again.
So, we need a combination of distinct and dense here.
btw, Please mark the thread as 'answered', if you feel you got your question answered. This will save the time of others who search for open questions to answer.
Regards,
CSM -
Retruning rows which have same value return by RANK function
Hi, what I wanna acheive is to use a DENSE RANK function to identify the same value of the data, if rank values are same then extra out. Here is the code
WITH CTE AS
SELECT SalesPersonID,
SalesQuota,
DENSE_RANK() OVER (ORDER BY SalesQuota DESC) as DENSE_RANK
FROM Sales.SalesPersonQuotaHistory
WHERE SalesQuota BETWEEN 266000.00 AND 319000.00
)This retrun
SalesPersonID SalesQuota DENSE_RANK
280 319000.00 1
287 304000.00 2
280 301000.00 3
282 288000.00 4
283 284000.00 5
287 281000.00 6
278 280000.00 7
283 280000.00 7
283 267000.00 8
278 266000.00 9How could I select those rank value which are same value ??
The result should be
278 280000.00 7
283 280000.00 7with cte as
select salespersonid,
salesquota,
dense_rank() over (order by salesquota desc) as dr
from sales.salespersonquotahistory
where salesquota between 266000.00 and 319000.00
select *
from (
select cte.*, count(*) over(partition by dr) ct
from cte
where ct > 1 -
Please help me with this query -- i am trying with Dense rank
version 10g
i received a quote for an account. if the same quote is received under different account then i should mark the previous account received as deleted.
please help me .
/* Formatted on 2010/06/28 14:13 (Formatter Plus v4.8.8) */
WITH temp AS
(SELECT '1-11TWQL' quote_id, 'COPS' ACCOUNT, 'Ordered' status,
TO_DATE ('12/23/2009 3:37:54',
'mm/dd/yyyy hh:mi:ss PM'
) captured_date
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'COPS', 'RFS',
TO_DATE ('12/23/2009 3:37:50', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'COPS', 'Rejected',
TO_DATE ('12/23/2009 3:37:52', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:51', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'Ordered',
TO_DATE ('12/23/2009 3:04:24', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'RFS',
TO_DATE ('12/23/2009 3:04:23', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'Rejected',
TO_DATE ('12/23/2009 3:04:22', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'Validated',
TO_DATE ('12/23/2009 3:04:23', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'RFS',
TO_DATE ('3/5/2010 12:04:24', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'RFS',
TO_DATE ('3/16/2010 7:55:50', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'RFS',
TO_DATE ('3/16/2010 7:55:51', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Rejected',
TO_DATE ('3/5/2010 12:04:24', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Rejected',
TO_DATE ('3/16/2010 7:55:50', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Rejected',
TO_DATE ('3/16/2010 7:55:51', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Ordered',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Ordered',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'RFS',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'RFS',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Validated',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Validated',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8Z', 'COPS', 'Validated',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL
UNION ALL
SELECT '1-249A8Z', 'COPS', 'Ordered',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
FROM DUAL)
SELECT quote_id, ACCOUNT, status, captured_date,
DENSE_RANK () OVER (PARTITION BY quote_id ORDER BY quote_id,
ACCOUNT) rn
-- ,CASE DENSE_RANK () OVER (PARTITION BY quote_id ORDER BY quote_id,
-- ACCOUNT)
-- WHEN 1
-- THEN 'Y'
-- ELSE 'N'
-- END deleted_flag
FROM temp
ORDER BY quote_id, captured_date;output required
WITH temp AS
(SELECT '1-11TWQL' quote_id, 'COPS' ACCOUNT, 'Ordered' status,
TO_DATE ('12/23/2009 3:37:54',
'mm/dd/yyyy hh:mi:ss PM'
) captured_date, 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'COPS', 'RFS',
TO_DATE ('12/23/2009 3:37:50', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'COPS', 'Rejected',
TO_DATE ('12/23/2009 3:37:52', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:51', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'Ordered',
TO_DATE ('12/23/2009 3:04:24', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'RFS',
TO_DATE ('12/23/2009 3:04:23', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'Rejected',
TO_DATE ('12/23/2009 3:04:22', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-11TWQL', 'D1', 'Validated',
TO_DATE ('12/23/2009 3:04:23', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'RFS',
TO_DATE ('3/5/2010 12:04:24', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'RFS',
TO_DATE ('3/16/2010 7:55:50', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'RFS',
TO_DATE ('3/16/2010 7:55:51', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Rejected',
TO_DATE ('3/5/2010 12:04:24', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Rejected',
TO_DATE ('3/16/2010 7:55:50', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Rejected',
TO_DATE ('3/16/2010 7:55:51', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'COPS', 'Validated',
TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM'), 'Y' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Ordered',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Ordered',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'RFS',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'RFS',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Validated',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8X', 'D1', 'Validated',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8Z', 'COPS', 'Validated',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL
UNION ALL
SELECT '1-249A8Z', 'COPS', 'Ordered',
TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM'), 'N' deleted_flag
FROM DUAL)
SELECT quote_id, ACCOUNT, status, captured_date, deleted_flag
FROM temp
ORDER BY quote_id, captured_date;try to wrap your query to become an in-line view. use a case statement or decode to your derived column RN from the analytic query of DENSE RANK. either way they both will work.
SQL> WITH temp AS
2 (SELECT '1-11TWQL' quote_id, 'COPS' ACCOUNT, 'Ordered' status,
3 TO_DATE ('12/23/2009 3:37:54',
4 'mm/dd/yyyy hh:mi:ss PM'
5 ) captured_date
6 FROM DUAL
7 UNION ALL
8 SELECT '1-11TWQL', 'COPS', 'RFS',
9 TO_DATE ('12/23/2009 3:37:50', 'mm/dd/yyyy hh:mi:ss PM')
10 FROM DUAL
11 UNION ALL
12 SELECT '1-11TWQL', 'COPS', 'Rejected',
13 TO_DATE ('12/23/2009 3:37:52', 'mm/dd/yyyy hh:mi:ss PM')
14 FROM DUAL
15 UNION ALL
16 SELECT '1-11TWQL', 'COPS', 'Validated',
17 TO_DATE ('12/23/2009 3:37:51', 'mm/dd/yyyy hh:mi:ss PM')
18 FROM DUAL
19 UNION ALL
20 SELECT '1-11TWQL', 'D1', 'Ordered',
21 TO_DATE ('12/23/2009 3:04:24', 'mm/dd/yyyy hh:mi:ss PM')
22 FROM DUAL
23 UNION ALL
24 SELECT '1-11TWQL', 'D1', 'RFS',
25 TO_DATE ('12/23/2009 3:04:23', 'mm/dd/yyyy hh:mi:ss PM')
26 FROM DUAL
27 UNION ALL
28 SELECT '1-11TWQL', 'D1', 'Rejected',
29 TO_DATE ('12/23/2009 3:04:22', 'mm/dd/yyyy hh:mi:ss PM')
30 FROM DUAL
31 UNION ALL
32 SELECT '1-11TWQL', 'D1', 'Validated',
33 TO_DATE ('12/23/2009 3:04:23', 'mm/dd/yyyy hh:mi:ss PM')
34 FROM DUAL
35 UNION ALL
36 SELECT '1-249A8X', 'COPS', 'RFS',
37 TO_DATE ('3/5/2010 12:04:24', 'mm/dd/yyyy hh:mi:ss PM')
38 FROM DUAL
39 UNION ALL
40 SELECT '1-249A8X', 'COPS', 'RFS',
41 TO_DATE ('3/16/2010 7:55:50', 'mm/dd/yyyy hh:mi:ss PM')
42 FROM DUAL
43 UNION ALL
44 SELECT '1-249A8X', 'COPS', 'RFS',
45 TO_DATE ('3/16/2010 7:55:51', 'mm/dd/yyyy hh:mi:ss PM')
46 FROM DUAL
47 UNION ALL
48 SELECT '1-249A8X', 'COPS', 'Rejected',
49 TO_DATE ('3/5/2010 12:04:24', 'mm/dd/yyyy hh:mi:ss PM')
50 FROM DUAL
51 UNION ALL
52 SELECT '1-249A8X', 'COPS', 'Rejected',
53 TO_DATE ('3/16/2010 7:55:50', 'mm/dd/yyyy hh:mi:ss PM')
54 FROM DUAL
55 UNION ALL
56 SELECT '1-249A8X', 'COPS', 'Rejected',
57 TO_DATE ('3/16/2010 7:55:51', 'mm/dd/yyyy hh:mi:ss PM')
58 FROM DUAL
59 UNION ALL
60 SELECT '1-249A8X', 'COPS', 'Validated',
61 TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM')
62 FROM DUAL
63 UNION ALL
64 SELECT '1-249A8X', 'COPS', 'Validated',
65 TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM')
66 FROM DUAL
67 UNION ALL
68 SELECT '1-249A8X', 'COPS', 'Validated',
69 TO_DATE ('12/23/2009 3:37:54', 'mm/dd/yyyy hh:mi:ss PM')
70 FROM DUAL
71 UNION ALL
72 SELECT '1-249A8X', 'D1', 'Ordered',
73 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
74 FROM DUAL
75 UNION ALL
76 SELECT '1-249A8X', 'D1', 'Ordered',
77 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
78 FROM DUAL
79 UNION ALL
80 SELECT '1-249A8X', 'D1', 'RFS',
81 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
82 FROM DUAL
83 UNION ALL
84 SELECT '1-249A8X', 'D1', 'RFS',
85 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
86 FROM DUAL
87 UNION ALL
88 SELECT '1-249A8X', 'D1', 'Validated',
89 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
90 FROM DUAL
91 UNION ALL
92 SELECT '1-249A8X', 'D1', 'Validated',
93 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
94 FROM DUAL
95 UNION ALL
96 SELECT '1-249A8Z', 'COPS', 'Validated',
97 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
98 FROM DUAL
99 UNION ALL
100 SELECT '1-249A8Z', 'COPS', 'Ordered',
101 TO_DATE ('3/26/2010 12:32:27', 'mm/dd/yyyy hh:mi:ss PM')
102 FROM DUAL)
103 select vt.quote_id,
104 vt.account,
105 vt.status,
106 vt.captured_date,
107 case when vt.rn = 1 then 'N'
108 else 'Y'
109 end deleted_flag
110 from (SELECT quote_id, ACCOUNT, status, captured_date,
111 DENSE_RANK () OVER (PARTITION BY quote_id ORDER BY quote_id, ACCOUNT) rn
112 FROM temp
113 ORDER BY quote_id, captured_date) vt;
QUOTE_ID ACCOUNT STATUS CAPTURED_DATE DELETED_FLAG
1-11TWQL D1 Rejected 23-Dec-2009 3 Y
1-11TWQL D1 RFS 23-Dec-2009 3 Y
1-11TWQL D1 Validated 23-Dec-2009 3 Y
1-11TWQL D1 Ordered 23-Dec-2009 3 Y
1-11TWQL COPS RFS 23-Dec-2009 3 N
1-11TWQL COPS Validated 23-Dec-2009 3 N
1-11TWQL COPS Rejected 23-Dec-2009 3 N
1-11TWQL COPS Ordered 23-Dec-2009 3 N
1-249A8X COPS Validated 23-Dec-2009 3 N
1-249A8X COPS Validated 23-Dec-2009 3 N
1-249A8X COPS Validated 23-Dec-2009 3 N
1-249A8X COPS RFS 05-Mar-2010 1 N
1-249A8X COPS Rejected 05-Mar-2010 1 N
1-249A8X COPS RFS 16-Mar-2010 7 N
1-249A8X COPS Rejected 16-Mar-2010 7 N
1-249A8X COPS Rejected 16-Mar-2010 7 N
1-249A8X COPS RFS 16-Mar-2010 7 N
1-249A8X D1 Ordered 26-Mar-2010 1 Y
1-249A8X D1 Ordered 26-Mar-2010 1 Y
1-249A8X D1 RFS 26-Mar-2010 1 Y
1-249A8X D1 RFS 26-Mar-2010 1 Y
1-249A8X D1 Validated 26-Mar-2010 1 Y
1-249A8X D1 Validated 26-Mar-2010 1 Y
1-249A8Z COPS Validated 26-Mar-2010 1 N
1-249A8Z COPS Ordered 26-Mar-2010 1 N
25 rows selected
SQL> -
/*below is the table format and data I have */
Create
table Result(name
varchar(50),Subject
varchar(20),Marks
int)
insert
into Result
values('Adam','Maths',70)
insert
into Result
values
('Adam','Science',80)
insert
into Result
values
('Adam','Social',60)
insert
into Result
values('Tom','Maths',60)
insert
into Result
values
('Tom','Science',50)
insert
into Result
values
('Tom','Social',70)
insert
into Result
values('Sam','Maths',90)
insert
into Result
values
('Sam','Science',90)
insert
into Result
values
('Sam','Social',80)
Since Same has the highest marks
, I want
TO display Sam
FIRST
AND
THEN list
ALL his marks.
THEN
Adam has SECOND highest marks so I want
TO display Adam
AND
THEN
ALL his marks
along
WITH this I also want
TO
RANK each ROW
below is my result set :
Name subject marks rank
Sam Maths 90 1
Sam Science 90 1
Sam Social 80 3
Adam Maths 80 4
Adam Science 70 5
Adam Social 60 6
Tom Social 70 7
Tom Maths 60 8
Tom Science 50 9I'm using ranking function to get the desired result set . But its not working .
here is what I'm using :
select
Name,Subject,Marks,
RANK
()over(partitionbynameorderbyMarksdesc)Rank
From
Result
order
byname,subject -
How to use "Rank" function in Oracle?
I need to display Top 15 records by using rank function.
Here is my query...I need to pull top 15 FAQ's using the below query.. How can I use RANK function to display the Top 15 FAQ"s in the list.
Select distinct SUb1.FAQ,Sub1.FAQ_Hits,GU.display_Name_FMLS as displayname,ev.ParentLinkrecordid,ev.userid from User GU
Join Event ev
ON LOWER (ev.userid) IN (LOWER (GU.lanid), LOWER (Gu.racfid))
Join (Select distinct sm.stem as FAQ,Sum(ev.Eventresults) as FAQ_Hits,ev.ParentLinkrecordid as Topic_ID from Event ev
Join SubjectMatter sm
ON (TO_CHAR (sm.smrecordid) = ev.eventdetail1) AND ev.eventdetail1 IS NOT NULL AND sm.smtype = 1
Where (Upper(ev.eventsubtype) in (Upper('FAQ'),Upper('OPENFAQ')))
AND TO_DATE (eventdatetime, 'yyyy-mm-dd hh24:mi:ss') >= TO_DATE ('20100601', 'yyyymmdd')
and TO_DATE (eventdatetime, 'yyyy-mm-dd hh24:mi:ss') <= TO_DATE ('20100831', 'yyyymmdd')
Group by sm.stem,ev.Parentlinkrecordid
order by FAQ )sub1
ON Sub1.Topic_ID = ev.ParentLinkrecordid)A few bits that I noticed in the query ...
in (Upper('FAQ'),Upper('OPENFAQ'))1) Do you really a upper for a string which is already in upper case.
Select distinct sm.stem as FAQ,Sum(ev.Eventresults) as FAQ_Hits,ev.ParentLinkrecordid as Topic_ID2) Do you need a distinct when you are using a GROUP function viz. SUM ?
You rank query is as follows, I am not very good at the ANSI style JOIN so changed it slightly ... :-)
Also notice the usage rank function in the "sub1" query.
select distinct sub1.faq,
sub1.faq_hits,
gu.display_name_fmls as displayname,
ev.parentlinkrecordid,
ev.userid
from user gu, event ev,
(select rank() over (order by sum(ev.eventresults) desc) rnk,
sum(ev.eventresults) as faq_hits,
sm.stem as faq,
ev.parentlinkrecordid as topic_id
from event ev, subjectmatter sm
where (to_char(sm.smrecordid) = ev.eventdetail1)
and ev.eventdetail1 is not null
and sm.smtype = 1
AND upper(ev.eventsubtype) in ('FAQ', 'OPENFAQ')
and to_date(eventdatetime, 'yyyy-mm-dd hh24:mi:ss') >= to_date('20100601', 'yyyymmdd')
and to_date(eventdatetime, 'yyyy-mm-dd hh24:mi:ss') <= to_date('20100831', 'yyyymmdd')
group by sm.stem, ev.parentlinkrecordid
order by faq) sub1
where lower(ev.userid) in (lower(gu.lanid), lower(gu.racfid))
and sub1.topic_id = ev.parentlinkrecordid)
and sub1.rnk <= 15;Like mentioned above, some sample data would have helped. -
Dense Lookup Function in OBIEE
Hi ,
Can someone please explain the syntax of Dense Lookup Function in OBIEE.
The function in the built-in RPD is using too many arguments and I am not able to understand it.
Thanks in Advance for the help.
AkshathaI had actually seen all those links. Thanks for your time although.
Actually, I have an expression like this.
lookup( DENSE LookupTable.DOMAIN_MEMBER_NAME, 'MCAT', 'CMP' || '~' || Table_A.TOP_LVL_PRODCAT_ID, VALUEOF(NQ_SESSION.USER_LANGUAGE_CODE), Table_A.DATASOURCE_NUM_ID)
I am not sure of what 'MCAT' and 'CMP' is here?
Is the || the concatenation operator?
Can you please explain this expression?
I hope I am not asking too much here :/
Akshatha -
Rank function without filter in the report
Hi,
I have a problem with Rank() function. The problem is the next one.
I have a table with this rows:
User | DATE | Cost
user1 | 12/02/2011 | 10,4
user1 | 13/02/2011 | 11,1
user1 | 13/02/2011 | 10,1
user1 | 13/02/2011 | 8,1
user2 | 12/02/2011 | 1,4
user2 | 13/02/2011 | 12,1
user2 | 13/02/2011 | 22,1
user2 | 13/02/2011 | 8,1
In the rpd I have a agregate row as SUM(COST), and I need extract te ranking of this SUM(COST) per user, The sum of user1 is 39,7 and the sum of the user 2 is 43,7. If I show in the report all users, the ranking is correct Rank=1 per user2 and Rank=2 per user1, but the problem is that I only want show the user1, when I add a filter to the report user='user1' the ranking value changes from 2 to 1. I need that the ranking value doesn´t change when I introduce a filter.
Any idea about how to solve this problem?
ThanksHi Antonio,
On the Rank column in the answers edit the formula as given below.
Case when username = 'user2' then Rank(sum(cost)) else 0 end
Then apply a filter on the Rank column as Rank > 0.
I hope this one helps you.
Regards
AP -
How to use RANK function ?
Hello everyone,
here is the query I run in sql developer using RANKFunction.
SELECT Empno, Ename, Job, Mgr, Hiredate, Sal
FROM
(SELECT Empno, Ename, Job, Mgr, Hiredate, Sal,
*RANK*() OVER
(ORDER BY SAL Desc NULLS LAST) AS Emp_Rank
FROM Emp
ORDER BY SAL Desc NULLS LAST)
WHERE Emp_Rank < 6;How I can use this query in my report in obiee or is there any replacement of RANK() function in obiee so that I can use that to get my same above result.
ThanksKuldip wrote:
Thanks, you are absolutely correct. However, By doing this I am getting my output as whic I was not expecting.
Students Marks Rank
student1 95 1
student2 95 1
student3 93 3
student4 93 3
student5 91 5
The output should be as instead
Students Marks Rank
student1 95 1
student2 95 1
student3 93 2
student4 93 2
student5 91 3
Can It be done like this ?
Thanks.
Edited by: Kuldip on Mar 15, 2012 11:51 PMHi Boss,
I think you copied the above scenario from this site..
http://oracle-bi.siebelunleashed.com/articles/rank-and-dense-rank-functionsobiee/
Then why asking how to do this? Are you testing us? Doesn't that site say how to achieve this? -
how to use the RANK function in oracle data integrator??
Hi,
a little google could help you..
https://forums.oracle.com/thread/2158588
Let us know -
Rank Function taking a long time to execute in SAP HANA
Hi All,
I have a couple of reports with rank function which is timing out/ or taking a really long time to execute, Is there any way to get the result in less time when rank functions are involved?
the following is a sample of how the Query looks,
SQL 1:
select a.column1,
b.column1,
rank () over(partition by a.column1 order by sum(b.column2) asc)
from "_SYS_BIC"."Analyticview1" b
join "Table1" a
on (a.column2 = b.column3)
group by a.column1,
b.column1;
SQL 2:
select a.column1,
b.column1,
rank () over( order by min(b.column1) asc) WJXBFS1
from "_SYS_BIC"."Analytic view2" b
cross join "Table 2" a
where (a.column2 like '%a%'
and b.column1 between 100 and 200)
group by a.column1,
b.column1
when I visualize the execution plan,the rank function is the one taking up a longer time frame. so I executed the same SQL without the rank() or partition or order by(only with Sum() in SQL1 and Min() in SQL 2) even that took a around an hour to get the result.
1.Does anyone have an any idea to make these queries to execute faster?
2. Does the latency have anything to do with the rank function or could it be size of the result set?
3. is there any workaround to implement these rank function/partition inside the Analytic view itself? if yes, will this make it give the result faster?
Thank you for your help!!
-GayathriKrishna,
I tried both of them, Graphical and CE function,
It is also taking a long time to execute
Graphical view giving me the following error after 2 hr and 36 minutes
Could not execute 'SELECT ORDER_ID,ITEM_ID,RANK from "_SYS_BIC"."EMMAPERF/ORDER_FACT_HANA_CV" group by ...' in 2:36:23.411 hours .
SAP DBTech JDBC: [2048]: column store error: search table error: [2620] executor: plan operation failed
CE function - I aborted after 40 mins
Do you know the syntax to declare local variable to use in CE function? -
Sql tuning using rank function
Hi,
Can someone help me in writing the below qry using rank() function?
DELETE FROM stc_calllog_ext a
WHERE a.stc_save_status = 'CT'
AND ROWID IN (SELECT a.ROWID
FROM stc_calllog_ext a, calllog_ext b
WHERE a.prod_line_code= b.prod_line_code
AND a.brand_code = b.brand_code
AND a.model_number = b.model_number
AND a.stc_save_status != b.stc_save_status
AND trunc(a.stc_start_time) = trunc(b.stc_start_time)
AND a.stc_start_time BETWEEN TRUNC(SYSDATE-8) AND TRUNC(SYSDATE)
AND a.call_taker_userid = b.call_taker_userid
AND a.cons_telephone_no =b.cons_telephone_no
)With the information you have provided, I've come up with the following.
SELECT A.ACCOUNT_NO, A.PAYMENT_TYPE, A.INSTALLMENT_TYPE, A.DATE_CHANGE
FROM
(SELECT account_no, payment_type, installment_type, date_change,
LEAD( (payment_type), 1)
over (partition by account_no order by account_no, DATE_CHANGE) LEAD_PAY,
LEAD( (installment_type), 1)
over (partition by account_no order by account_no, DATE_CHANGE) LEAD_INST
from T_ACCNTS ) A
WHERE A.PAYMENT_TYPE <> NVL(A.LEAD_PAY,99)
OR A.INSTALLMENT_TYPE <> NVL(A.LEAD_INST,99)
ORDER BY 1, 4; -
Error using Rank function in Answers
Hi All,
Am trying to generate a report in Answers which lists Top Accounts with Revenue.
I Ranked the Revenue field and it is returning me correct values. ( Rank(account.revenue) )
But, when I try to filter on this field and restrict the rows which shows only top 10 Accounts, it is returning the following error:
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1792, message: ORA-01792: maximum number of columns in a table or view is 1000 at OCI call OCIStmtExecute. [nQSError: 17010] SQL statement preparation failed. (HY000)
Can any one help me on this.
Thanks in Advance,
Imtiaz.Hi Joe,
This is the Physical query generated when I use Rank function and the report is fine.
select distinct D1.c1 as c1,
D1.c2 as c2,
D1.c3 as c3,
D1.c4 as c4,
D1.c5 as c5,
D1.c6 as c6,
D1.c7 as c7,
D1.c8 as c8,
D1.c9 as c9,
D1.c10 as c10,
D1.c11 as c11,
D1.c12 as c12,
D1.c13 as c13,
D1.c14 as c14,
D1.c15 as c15
from
(select D1.c1 as c1,
D1.c2 as c2,
D1.c3 as c3,
D1.c4 as c4,
D1.c5 as c5,
D1.c6 as c6,
D1.c7 as c7,
D1.c8 as c8,
D1.c9 as c9,
D1.c10 as c10,
D1.c11 as c11,
D1.c12 as c12,
D1.c13 as c13,
D1.c14 as c14,
D1.c15 as c15
from
(select Case when D1.c1 is not null then Rank() OVER ( ORDER BY D1.c1 DESC NULLS LAST ) end as c1,
D1.c2 as c2,
D1.c3 as c3,
D1.c1 as c4,
D1.c4 as c5,
D1.c5 as c6,
D1.c6 as c7,
D1.c7 as c8,
D1.c8 as c9,
D1.c9 as c10,
D1.c10 as c11,
D1.c11 as c12,
D1.c12 as c13,
D1.c13 as c14,
D1.c14 as c15,
ROW_NUMBER() OVER (PARTITION BY D1.c1, D1.c2, D1.c3, D1.c4, D1.c5, D1.c6, D1.c7, D1.c8, D1.c9, D1.c10, D1.c11, D1.c12, D1.c13, D1.c14 ORDER BY D1.c1 ASC, D1.c2 ASC, D1.c3 ASC, D1.c4 ASC, D1.c5 ASC, D1.c6 ASC, D1.c7 ASC, D1.c8 ASC, D1.c9 ASC, D1.c10 ASC, D1.c11 ASC, D1.c12 ASC, D1.c13 ASC, D1.c14 ASC) as c16
from
(select distinct T690.SUM_REVN_AMT as c1,
T690.NAME as c2,
T2216.NAME as c3,
T690.X_PETROFAC_REVN as c4,
T690.SUM_WIN_PROB as c5,
T690.X_PERCENT_GET as c6,
T690.SUM_WIN_PROB * T690.X_PERCENT_GET / nullif( 100, 0) as c7,
T690.X_EC_PRIORITY as c8,
T19028.LOGIN as c9,
T690.X_COUNTRY as c10,
T690.X_REGION as c11,
T18311.NAME as c12,
T18641.NAME as c13,
T18238.NAME as c14
from
SIEBEL.S_BU T18238 left outer join (
SIEBEL.S_USER T19028 left outer join (
SIEBEL.S_OPTY T690 left outer join SIEBEL.S_STG T2216 On T690.CURR_STG_ID = T2216.ROW_ID) left outer join SIEBEL.S_ORG_EXT T1189 On T690.PR_DEPT_OU_ID = T1189.ROW_ID) left outer join SIEBEL.S_ORG_EXT T18311 /* Competitor */ On T690.PR_CMPT_OU_ID = T18311.ROW_ID) left outer join SIEBEL.S_ORG_EXT T18641 /* Partner */ On T690.PR_PRTNR_ID = T18641.ROW_ID) left outer join SIEBEL.S_POSTN T19114 On T690.PR_POSTN_ID = T19114.PAR_ROW_ID) left outer join SIEBEL.S_OPTY_BU T18280 On T690.ROW_ID = T18280.OPTY_ID) left outer join SIEBEL.S_OPTY_X T19415 On T690.ROW_ID = T19415.PAR_ROW_ID) On T19028.PAR_ROW_ID = T19114.PR_EMP_ID) On T18238.ROW_ID = T18280.BU_ID
) D1
) D1
where ( D1.c16 = 1 )
) D1
order by c1 desc
But When I apply Filter on this Rank column then it gives me the error. THis is the Physical query for that
select distinct Case when D1.c1 is not null then Rank() OVER ( ORDER BY D1.c1 DESC NULLS LAST ) end as c1,
D1.c2 as c2,
D1.c3 as c3,
D1.c1 as c4,
D1.c4 as c5,
D1.c5 as c6,
D1.c6 as c7,
D1.c7 as c8,
D1.c8 as c9,
D1.c9 as c10,
D1.c10 as c11,
D1.c11 as c12,
D1.c12 as c13,
D1.c13 as c14,
D1.c14 as c15
from
(select D1.c1 as c1,
D1.c2 as c2,
D1.c3 as c3,
D1.c4 as c4,
D1.c5 as c5,
D1.c6 as c6,
D1.c7 as c7,
D1.c8 as c8,
D1.c9 as c9,
D1.c10 as c10,
D1.c11 as c11,
D1.c12 as c12,
D1.c13 as c13,
D1.c14 as c14
from
(select T690.SUM_REVN_AMT as c1,
T690.NAME as c2,
T2216.NAME as c3,
T690.X_PETROFAC_REVN as c4,
T690.SUM_WIN_PROB as c5,
T690.X_PERCENT_GET as c6,
T690.SUM_WIN_PROB * T690.X_PERCENT_GET / nullif( 100, 0) as c7,
T690.X_EC_PRIORITY as c8,
T19028.LOGIN as c9,
T690.X_COUNTRY as c10,
T690.X_REGION as c11,
T18311.NAME as c12,
T18641.NAME as c13,
T18238.NAME as c14,
Case when T690.SUM_REVN_AMT is not null then Rank() OVER ( ORDER BY T690.SUM_REVN_AMT DESC NULLS LAST ) end as c15
from
SIEBEL.S_BU T18238 left outer join (
SIEBEL.S_USER T19028 left outer join (
SIEBEL.S_OPTY T690 left outer join SIEBEL.S_STG T2216 On T690.CURR_STG_ID = T2216.ROW_ID) left outer join SIEBEL.S_ORG_EXT T1189 On T690.PR_DEPT_OU_ID = T1189.ROW_ID) left outer join SIEBEL.S_ORG_EXT T18311 /* Competitor */ On T690.PR_CMPT_OU_ID = T18311.ROW_ID) left outer join SIEBEL.S_ORG_EXT T18641 /* Partner */ On T690.PR_PRTNR_ID = T18641.ROW_ID) left outer join SIEBEL.S_POSTN T19114 On T690.PR_POSTN_ID = T19114.PAR_ROW_ID) left outer join SIEBEL.S_OPTY_BU T18280 On T690.ROW_ID = T18280.OPTY_ID) left outer join SIEBEL.S_OPTY_X T19415 On T690.ROW_ID = T19415.PAR_ROW_ID) On T19028.PAR_ROW_ID = T19114.PR_EMP_ID) On T18238.ROW_ID = T18280.BU_ID
) D1
where ( D1.c15 <= 10 )
) D1
order by c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15
Thanks,
Imtiaz -
Hi Friends,
Need your help. Please!!!
I have used the RANK function to know the different Start, end date period for a Enrollment.NO.
What I want next is to show only the Enroll No, start, end date for a Enrollment No. with the earliest start date, end date. i.e Max(Rank) for that enrollment No.
for RANK column I have used the function RANK("Start Date" by "EnRoll No")
EnRoll No. Start Date, End Date, Rank
BAD-002 01-Oct-12 31-Dec-12 1
01-Jul-12 30-Sep-12 2
01-Apr-12 30-Jun-12 3
RIS-401 01-Dec-06 28-Feb-07 1
01-Sep-06 30-Nov-06 2
01-Jun-06 31-Aug-06 3
01-Mar-06 31-May-06 4
01-Dec-05 28-Feb-06 5
01-Sep-05 30-Nov-05 6
01-Jun-05 31-Aug-05 7
01-Mar-05 31-May-05 8
01-Dec-04 28-Feb-05 9
RCB-235 01-Dec-08 28-Feb-09 1
01-Sep-08 30-Nov-08 2
01-Jun-08 31-Aug-08 3
01-Mar-08 31-May-08 4
01-Dec-07 29-Feb-08 5
01-Sep-07 30-Nov-07 6
01-Jun-07 31-Aug-07 7
01-Mar-07 31-May-07 8
01-Dec-06 28-Feb-07 9
01-Sep-06 30-Nov-06 10
01-Jun-06 31-Aug-06 11
01-Mar-06 31-May-06 12
01-Dec-05 28-Feb-06 13
01-Sep-05 30-Nov-05 14
My desired output is:
EnRoll No. Start Date End Date Rank
BAD-002 01-Apr-12 30-Jun-12 3
RIS-401 01-Dec-04 28-Feb-05 9
RCB-235 01-Sep-05 30-Nov-05 14
Please help me. Its urgent. I am struck at this point.
Many Thanks in advance.
AachalaHi Aachala,
Add the following to your filter and you should be all set...
MAX(RANK("Start Date" by "EnRoll No") by "EnRoll No") = RANK("Start Date" by "EnRoll No") by "EnRoll No")
JB -
Rank function breaks drill down 11g
I have a simple drill down report standard hierarchy and am having a weird issue with the rank function.
This report works on 10g but the upgraded 11g version does not.
When I drill down past the 2nd level it adds an is null filter to the revenue column. This is also the column we are using to base our rank function.
If I move the rank column to the first or last position in the table the drills work perfectly. If I move it to the second column it breaks on the first drill instead of the 2nd.
It works perfectly if drilling on the headings instead of the values. That seems to point to some sort of null coming through when being passed. I've tried using an ifnull and a case statement and neither method works, it just applies the is null filter to the entire column formula.
The client doesn't want to change the position of the rank column so that work around will not do. Any ideas?A similar thread was recently talked about here:
In OBIEE charts, how do you make drill downs work on custom formulas?
With a calculated column, you need to make sure the source query and destination query have the EXACT same formula and the same name for the field. If it is not 100% identical, it may not work correctly. (I typically use the NAVIGATE function to get to the second query rather than the Drill function.)
Now in some cases, if you try to create a second drill down query with more details in it, the original formula doesn't work the way you want it to. The calculated formulas have to make sense in both source query and destination query in order to work properly. If you have a ranking of the Top 5 Products in the source query, the destination query also has to have the same ranking of Top 5 products in order to work. If you add more fields into the destination query (e.g., adding on product attributes, or # of records associated with that product name etc.), then sometimes the ranking / aggregation in the destination doesn't add up the same way. This causes the system to think that the formulas are different and prevents the drill down.
I managed to get around this by having a 3rd query in between the original summary view and the detailed data view. So the sequence would be (for example):
- Dashboard based summary query (including the calculated ranked product names formula)
- drill down into virtually identical query (add on one slight bit of difference here, for example adding on a second Product Name field ... not a calculated version, but the actual name). Create a drill down this time by clicking on the regular Product Name field (don't drill down on the custom formula)
- final detailed drill-down query
You can format this intermediary drill down query to explain to users that they need to click a second time.
It's not ideal, but it should work. Hope this helps.
Ted
Maybe you are looking for
-
Photo stream not updating in Photos on iMac
My photos stream is working on iPhone and iPad but not on the iMac - it accesses photos from about 10 days ago, that's from before Photos was installed but it won't automatically pick up new photos taken on iPhone or iPad since Photos replaced iPhoto
-
Classpath and property problem in services
Hi, all, I've had a number of problems getting the Stockquote example to run properly. This seems to be due to a problem that services don't get either classpaths or properties when they start. The first manifestation of this problem came when the pr
-
How to comment/uncomment section of XML file with JAXP?
Hi, I need to periodically under some condition, comment or uncomment a section of my XML file. I want to know is there a way that I can do it with JAXP? I am using JDK 1.5 Thanks,
-
Burning hd dvd on single layer dvd
I have just burned my first hd dvd onto a normal single layer dvd and it works beautifully on my Mac but does not play in any hd dvd player I could find to test in South Africa, neither in my friends' pcs. What is wrong?
-
Hi, We have implemented ESS .We have created workflow for timesheet approval. Whenever employee creates a timesheet request.The workitem sent to Manager to approve the timesheet records.But when Manager opens the workitem regarding timesheet approval