How to count Unique Values in BEx
Hi Guys,
Can anybody please let me know how to count unique values of a characteristic.
Thanx in advance
Peter
I have a similar scenario. If i drill up on the characterstic that had a count of one in each record, the total number of records should be stay equal to the summarised results in the last screen.
Would someone know how to do that .
Arti
Similar Messages
-
How to count unique values based on specific criteria
Hello,
I need to count the number of unique values in column A but only if the text in column I is a specific word - how do I do this?Let's say the values are in A1:A10 and they are numeric, and the text is in I1:I10.
As an array formula, confirmed with Ctrl+Shift+Enter:
=SUM(IF(I1:I10="word",1/COUNTIFS(A1:A10,A1:A10,I1:I10,"word")))
where "word" is the specific word you're looking for.
Regards, Hans Vogelaar (http://www.eileenslounge.com) -
I want to update the unique values, if they are not inserted... Please help in this regard
CREATE OR REPLACE PROCEDURE PR IS
lv_operator VARCHAR2(1) := 'N';
TYPE subset_rt IS RECORD
ltt_whse_loc oe_sales_ord_commit.whse_loc%TYPE,
ltt_shape oe_sales_ord_commit.shape%TYPE,
ltt_isize oe_sales_ord_commit.isize%TYPE,
ltt_grade oe_sales_ord_commit.grade%TYPE,
ltt_length oe_sales_ord_commit.length%TYPE,
ltt_pieces NUMBER,
ltt_inv_lbs_commit oe_sales_ord_commit.inv_lbs_commit%TYPE,
ltt_roll_lbs_commit oe_sales_ord_commit.roll_lbs_commit%TYPE,
ltt_ishcom_lbs oe_sales_ord_commit.ishcom_lbs%TYPE);
TYPE subset_aat IS TABLE OF subset_rt
INDEX BY PLS_INTEGER;
aa_subset subset_aat;
errors NUMBER;
dml_errors EXCEPTION;
PRAGMA EXCEPTION_INIT(dml_errors, -24381);
BEGIN
lv_operator := sy_checkpriv(USER,
'SY_OPERATIONS');
SELECT whse_loc,
shape,
isize,
grade,
length,
0,
inv_lbs_commit,
roll_lbs_commit,
ishcom_lbs
BULK COLLECT INTO aa_subset
FROM oe_sales_ord_commit_temp
WHERE processed_datetime IS NULL
AND username = decode(lv_operator,
'Y',
username,
USER);
BEGIN
FORALL indx IN 1 .. aa_subset.COUNT SAVE EXCEPTIONS
INSERT INTO
(SELECT loc,
shape,
isize,
grade,
length,
pieces,
inv_lbs_commit,
roll_lbs_commit,
ishcom_lbs FROM oe_inventory_temp)
VALUES
aa_subset(indx);
EXCEPTION
WHEN OTHERS THEN
*+<<Trap the rows that have failed due to dup_val_on_index exception and update the inv_lbs_commit,+*
*+roll_lbs_commit, ishcom_lbs columns in oe_inventory_temp table>>+*
-- loc,shape, isize,grade, length, pieces are composite primary keys.
errors := SQL%BULK_EXCEPTIONS.COUNT;
DBMS_OUTPUT.PUT_LINE('Number of statements that failed: ' || errors);
FOR i IN 1..errors LOOP
DBMS_OUTPUT.PUT_LINE('Error #' || i || ' occurred during '||
'iteration #' || SQL%BULK_EXCEPTIONS(i).ERROR_INDEX);
DBMS_OUTPUT.PUT_LINE('Error message is ' ||
SQLERRM(-SQL%BULK_EXCEPTIONS(i).ERROR_CODE));
DBMS_OUTPUT.PUT_LINE(aa_subset(SQL%BULK_EXCEPTIONS(i).ERROR_INDEX));
END LOOP;
END;
END PR;
/Due to the following restriction a number of simple collections is used instead of the collection of records.
[FORALL Statement|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/forall_statement.htm#sthref2742]: You cannot refer to individual record fields within DML statements called by a FORALL statement. Instead, you can specify the entire record with the SET ROW clause in an UPDATE statement, or the VALUES clause in an INSERT statement.
10g syntax of FORALL statement is used:
SQL> select * from a;
INT DT STR
1 10.02.2009 123
2 11.02.2009 567
SQL> desc a
Name Null? Type
INT NOT NULL NUMBER(38)
DT DATE
STR VARCHAR2(20)
SQL> select * from a;
INT DT STR
1 10.02.2009 123
2 11.02.2009 567
SQL> DECLARE
2 TYPE T_Int_List IS TABLE OF A.Int%TYPE INDEX BY PLS_INTEGER;
3 TYPE T_Dt_List IS TABLE OF A.Dt%TYPE INDEX BY PLS_INTEGER;
4 TYPE T_Str_List IS TABLE OF A.Str%TYPE INDEX BY PLS_INTEGER;
5
6 vInts T_Int_List;
7 vDts T_Dt_List;
8 vStrs T_Str_List;
9
10 eBulk_Error EXCEPTION;
11 PRAGMA EXCEPTION_INIT(eBulk_Error, -24381);
12 BEGIN
13 vInts(1) := 2;
14 vDts(1) := sysdate - 1;
15 vStrs(1) := '888';
16
17 vInts(2) := 3;
18 vDts(2) := sysdate - 22;
19 vStrs(2) := '0000';
20
21 BEGIN
22 FORALL indx IN INDICES OF vInts SAVE EXCEPTIONS
23 INSERT INTO A(Int, Dt, Str)
24 VALUES(vInts(indx), vDts(indx), vStrs(indx));
25 EXCEPTION
26 WHEN eBulk_Error THEN
27 DECLARE
28 vErr_Count INTEGER;
29 vErr_Message VARCHAR2(2000);
30 vErr_Indices T_Int_List;
31 BEGIN
32 vErr_Count := SQL%BULK_EXCEPTIONS.COUNT;
33 -- Getting the indices of rows with duplicate key
34 -- FOR vI IN 1 .. SQL%BULK_EXCEPTIONS.COUNT LOOP - Doesn't work for some reason on 10.2.0.1.0
35 FOR vI IN 1 .. vErr_Count LOOP
36 IF SQL%BULK_EXCEPTIONS(vI).Error_Code <> 1 THEN
37 -- Error other that duplicate key is reraised
38 vErr_Message := SQLERRM(-SQL%BULK_EXCEPTIONS(vI).Error_Code);
39 Raise_Application_Error(-20001, vErr_Message);
40 END IF;
41 vErr_Indices(SQL%BULK_EXCEPTIONS(vI).ERROR_INDEX) := SQL%BULK_EXCEPTIONS(vI).ERROR_INDEX;
42 END LOOP;
43
44 -- Bulk update
45 FORALL vI IN INDICES OF vErr_Indices
46 UPDATE A SET
47 Dt = vDts(vI),
48 Str = vStrs(vI)
49 WHERE Int = vInts(vI);
50 END;
51 END;
52 END;
53 /
PL/SQL procedure successfully completed.
SQL> select * from a;
INT DT STR
1 10.02.2009 123
2 09.02.2009 888
3 19.01.2009 0000Regards,
Dima
Edited by: DimaCit on Feb 10, 2009 10:39 AM -
How to count unique entries accross the data grid?
So I have managed to put a bunch of data into a partitioned cache 3 nodes.
And now I would like to perform the following query/calculation.
Say I have the following model...
Person
firstName
lastName
phoneNumber
creditCard
email
ipAddress
Given a person's email, count unique phoneNumbers, ipaddresses and creditCards.
Or
Given a person' s credit card count how many unique phonenumber, emails and ipAddresses.
That said if we have the follwoing data...
John Smith - [email protected] - 555-555-5555 - 1234567890000000 - xxx.xxx.xxx.xxx
John Smith - [email protected] - 999-555-5555 - 1234567890000000 - xxx.xxx.xxx.yyy
John Smith - [email protected] - 777-555-5555 - 1234567890000000 - xxx.xxx.xxx.yyy
For query 1 given [email protected] I should get back
1 unique phoneNumber
1 unique creditCard
2 unique ips
For query 2 given 1234567890000000
3 unique phoneNumbers
2 unique emails
2 unique ips
Is possible through a regular query?
Basically it's a cross reference algorithm.
Edited by: 884647 on Sep 27, 2011 8:33 AM
Edited by: 884647 on Sep 27, 2011 8:37 AMJust found this in a thread...
Filter filter = ....
ValueExtractor email = new ReflectionExtractor("email");
ValueExtractor phone = new ReflectionExtractor("phonenumber");
ValueExtractor ip = new ReflectionExtractor("phonenumber");
Map mapResult = cache.aggregate(filter, new CompositeAggregator(new EntryAggregator[] {new ReducerAggregator(email), new ReducerAggregator(phone), new ReducerAggregator(ip)});
Seems like the right solution and this works across a partitioned cache? -
Hi,
In a Table 50 Columns are there and 10 Records are there. In those 10 records are not inserted all columns (Some are null values). How to find The Count of Record (Row) Values .
For Example
Table
p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 .........
10 20 30 40 50
20 30
60 80
In the Above table, how to find
the count of values in 1st record is 5
the count of values in 2nd record is 2
the count of values in 3rd record is 2
Thanks & Regards,
HariHi ,
CREATE TABLE Sample
Col1 NUMBER(2),
Col2 NUMBER(2),
Col3 NUMBER(2),
Col4 NUMBER(2),
Col5 NUMBER(2),
Col6 NUMBER(2),
Col7 NUMBER(2),
Col8 NUMBER(2),
Col9 NUMBER(2),
Col10 NUMBER(2)
Table Created.
I inserted Data like below
Col1 Col2 Col3 Col4 Col5 Col6 Col7 Col8 Col9 Col10
10 20 30 40 50 70 60
10 30 40 50 60 20
10 20 30
10 20 30 40
10 20 30 40 50
10 20 30 40 50 60 70 80 90 100
10 20
10 20 30 40
10 20 30 40 50 60 70
10 20 30 40
In the above data, How To find out
1st row has 7 Values (Which Columns are not null)
2nd Row has 6 Values
3rd Row has 3 Values
4th Row has 4 Values
5th Row has 5 Values
6th Row has 10 Values
7th Row has 2 Values
8th Row has 4 Values
9th Row has 7 Values
10th Row has 4 Values -
How to ensure unique values of all records in the form?
Hi all,
I need to do some personalization in this Oracle EBS Form - Purchasing Super User -> Receiving -> Receipts -> Lot Entry
I must ensure that evry record entered on that form has a unique value in the column Lot Number.
Can anybody advise me please?
Thank you, WillyHi there.
One way to do this is to do a SPQuery and convert it to a datatable using the GetDataTable method and then to a View. The View then has the ability to get unique values using the ToTable method, something like this:
SPList list = SPContext.Current.Web.Lists["MyList"];
SPQuery query = new SPQuery();
query.Query = "<OrderBy><FieldRef Name='Title' /></OrderBy>";
DataTable table = list.GetItems(query).GetDataTable();
DataView v = new DataView(table);
string[] columns = {"Title"};
DataTable tbl = v.ToTable(true, columns);
Hope this helps.
Regards,
Magnus
My blog: InsomniacGeek.com -
How to make empty values in Bex to zero so that WEbI also has 0
Hi
I have a webI report on Bex query, some of the values in the columns are empty in Bex, so even the webI report is showing blank values. But when i want to calculate totals, avg, or alerts on that column in WebI then I need to write a formula for each measure saying
if(isnull([keyfigure])) then o else [keyfigure]
It is working in WebI but lot of custom work need to be done, instead is there any setting in Bex or WebI saying that columns with the "blank" values in Bex should be shown as "0" in the webI report column?Hi,
Take a look here:
Re: Fill empty cell with '0'
Steps to fill empty cell with '0':-
1. Select intersection cell in cross tab.
2. Go to properties tab.
3. In Text Format section, click on Number Format button.
4. Select Format type is 'Number' and check the Custom check box.
5. Enter 0 in all text boxes(Positive, Negative, Equal to zero, and Undefined).
6. Click ok.
Now you can see 0 in the Emply cells of cross tab.
If you want decimal values, enter 0.00 in Positive box.
Edited by: Swarna K on Mar 12, 2011 9:25 AM -
How to remove unassigned(#) value in bex report in 04s
Any help on hiding/ removing unassigned(#) value in bex report in 04s , the query is created on an infoset( left outer join).
you can exclude # in your restriction...
assign points if it helps -
How to enter multiple values in BEX Analyzer 7.0
We are on 7.0. I created a query in Query Designer with a variable type of Select Option. When I execute the query in BEX Analyzer, how do I enter multiple selections?
Thanks.
RyanHi Ryan,
You need to click on the button on the right of the variable (with a white square). In the box that pops up, choose your values. On the same screen, click the More>> button to see your selection and change the order if required.
Hope this helps... -
How to use rounded values in BEx Formulas
Hello,
I have the following question. Is it possible to use rounded values up to a certain # of decimal points in BEx Formulas?
I have the following problem.
Consider this:
keyfigure val 1 = 0.416666667
keyfigure val 2 = 72
val 3 (BEx Formula) = val 2 / val 1 = 172.799999862
However, what I need to do is this.
val 1 & val 3 should rounded up to 2 decimal points. So, I really need the report to show this:
val1 = 0.42
val2 - 72
val 3 = val 2 /val 1 = 171.43
I changed the number of decimal places on val 1 and val3 to be 0.00. However, it appears that these rounded values are not taken into account in the Formulas, as if the OLAP still uses the original values from the backend with 9 decimal points. So, no matter how many decimal points I use on the Display tab for a key figure, my val3 or result of my formula is always taking into account the 9 digit decimal values, not rounded values that I want. So in the example above, my val 3 comes to 172.80, which it should be 171.43 instead of you use the rounded values in the calculation.
Please let me know if there is any workaround where I could force my BEx Formula to utilize the rounded values and not actual values from the backend DSO. Or any other solution.
Thank youIf you create a Formula in BEx Query Designer like the one below, it works:
val3 = val2 / ( TRUNC ( ( val1 * 100 + 0.5 ) ) / 100 )
The TRUNC function (among other things) actually ensures that your formula takes into account the rounded values that you want. -
How to show Blank values in Bex Report
Hi friends ,
In my bex report one of the KF Column having zero's and Blank values .
Ex . Mat Price
A 0
B
C 15
when i create a condition Price > 0
Then the given Out put is
Mat Price
C 15
but the required Out put is
Mat Price
B
C 15
I.e I have to Remove only zeros and i should show blank values. Could you pls give some Ideas on this .Hi friends thanks for response,
but my requirement is
Mat
Price1
Price2
A
0
B
12
C
15
D
0
E
8
F
0
The Required Out put should be
Mat
Price1
Price2
Price3 (1+2 )
B
12
12
C
15
15
D
0
0
E
8
8
The user don't want see materials Price1 which is Zero . So I should remove materials A and F in Price1 column .
IF i apply condition on Price1 > 0 in the out put B and D also not displaying bcoz blank values consider as Zero.
Can you pls give some ideas how to full fill this Requirement -
How to pass parameter values to Bex query through xcelsius (LO or QWAAS)
Hi,
I have prompt in Bex query and want to pass values to query prompt through xcelsius .
In xcelsius i have selection
e.g 1] Combo selection is for Vendor
2] Combo selection is for Fiscal Year
If i select value from Combo list and refresh the dashboard im getting below error
A database error occured. The database error text is: The MDX query SELECT { [Measures].[4IKKZVYWWD3XKQK7Z1BK34VTL], [Measures].[4IKKZVJJUFWIJHHBND6VJ0YE1], [Measures].[4IKKZV46SIP3I8EFBP26YX0YH], [Measures].[4IKKZUOTQLHOGZBJ00XIET3IX] } ON COLUMNS , NON EMPTY [0CREDITOR].[LEVEL01].MEMBERS ON ROWS FROM [0FIAP_O03/ZFIAP_O03_UNIVERSE] SAP VARIABLES [VN_VAR] INCLUDING A00140 [0S_FYEAR] INCLUDING V3/2010 : V3/2010 failed to execute with the error Unknown error. (WIS 10901)
I have tried using LO and QWAAS but not able to do so......
if any one knows plz help....Hi,
most likely yo are passing the wrong value.
you need to send the key or the member unique name.
Ingo -
How to generate unique values while initializing values
I am initializing values in my pl/sql program and want to use a sequence to set my unique ids but it errors out. Below is what I use.
ie. table_id := table_seq.nextval;
How can I use my sequence to initialize values or is this possible?The method suggested by user605919 will work. However, you don't need to initialize a variable like this. It is better and more performant to do it like the third example below:
SQL> create table mytable
2 ( id number(6)
3 , description varchar2(30)
4 )
5 /
Tabel is aangemaakt.
SQL> create sequence table_seq start with 1 increment by 1
2 /
Reeks is aangemaakt.
SQL> declare
2 table_id mytable.id%type := table_seq.nextval;
3 begin
4 insert into mytable
5 ( id
6 , description
7 )
8 values
9 ( table_id
10 , 'Some description'
11 );
12 end;
13 /
table_id mytable.id%type := table_seq.nextval;
FOUT in regel 2:
.ORA-06550: line 2, column 41:
PLS-00357: Table,View Or Sequence reference 'TABLE_SEQ.NEXTVAL' not allowed in this context
ORA-06550: line 2, column 12:
PL/SQL: Item ignored
ORA-06550: line 9, column 5:
PLS-00320: the declaration of the type of this expression is incomplete or malformed
ORA-06550: line 9, column 5:
PL/SQL: ORA-00904: "TABLE_ID": invalid identifier
ORA-06550: line 4, column 3:
PL/SQL: SQL Statement ignored
SQL> declare
2 table_id mytable.id%type;
3 begin
4 select table_seq.nextval
5 into table_id
6 from dual
7 ;
8 insert into mytable
9 ( id
10 , description
11 )
12 values
13 ( table_id
14 , 'Some description'
15 );
16 end;
17 /
PL/SQL-procedure is geslaagd.
SQL> begin
2 insert into mytable
3 ( id
4 , description
5 )
6 values
7 ( table_seq.nextval
8 , 'Some description'
9 );
10 end;
11 /
PL/SQL-procedure is geslaagd.And if you need the id value for some code after the insert, you use the RETURNING clause.
Regards,
Rob. -
Routine to count unique values
Hi Gurus,
I am BI user, I am trying to write a routine to populate count if employee and month from source fields is unique.
For example:
Employee calmonth count
10000 01.2008 1
10000 02.2008 1
10001 01.2008 1
10000 01.2008 0
Please can you help me with the code and any suggestions to write the code.
Regards,
Reddy.Hi Eric,
Below is my code, count is always showing "0".
CLASS routine IMPLEMENTATION
CLASS lcl_transform IMPLEMENTATION.
METHOD compute_0HDCNT_LAST.
IMPORTING
request type rsrequest
datapackid type rsdatapid
SOURCE_FIELDS-PERSONAL_NO TYPE N LENGTH 000008
SOURCE_FIELDS-ZZMONTH TYPE C LENGTH 000007
EXPORTING
RESULT type tys_TG_1-HDCNT_LAST
DATA:
MONITOR_REC TYPE rsmonitor.
$$ begin of routine - insert your code only below this line -
TYPES:
BEGIN of ty_itab,
PERSONAL_NO(8) type n,
ZZMONTH(7) type c,
count(1) type c,
end of ty_itab.
data: itab type table of ty_itab.
field-symbols : <line> type ty_itab.
append SOURCE_FIELDS-PERSONAL_NO to itab.
append SOURCE_FIELDS-ZZMONTH to itab.
sort itab by PERSONAL_NO ZZMONTH.
loop at itab assigning <line>.
<line>-count = '0'.
AT NEW ZZMONTH.
<line>-count = '1'.
ENDAT.
endloop.
$$ end of routine - insert your code only before this line -
ENDMETHOD. "compute_0HDCNT_LAST
Method invert_0HDCNT_LAST
This subroutine needs to be implemented only for direct access
(for better performance) and for the Report/Report Interface
(drill through).
The inverse routine should transform a projection and
a selection for the target to a projection and a selection
for the source, respectively.
If the implementation remains empty all fields are filled and
all values are selected.
METHOD invert_0HDCNT_LAST.
$$ begin of inverse routine - insert your code only below this line-
... "insert your code here
$$ end of inverse routine - insert your code only before this line -
ENDMETHOD. "invert_0HDCNT_LAST
ENDCLASS. "routine IMPLEMENTATION -
How to calculate avg value in bex
Hi all
I have a requirement
I want to run a query for a particular period say 0032005.
in the query output value will display for all prior period in different column. for perod 003
it will display value for 001 , 002 ,003. and
at the last column i want calculate the avarage for this 3 period. these should be dinamic.
if i run this query for period 0052005. query will display value for period 001 ,002 ,003,004,005 and last column will display avarage for the 5 period.
i am able to diaplay each prior period in different column that is fine. but i am not abel to calculate the avarage column.
example
selection screen :
fiscal period : 0042005
Query output
Char 0012005 0022005 0032005 0042005 Avg
88 99 77 66 (889977+66)/004
Please any one know about please help with steps.
ThanksI have a requirement
I want to run a query for a particular period say 0032005.
in the query output value will display for all prior period in different column. for perod 003
it will display value for 001 , 002 ,003. and
at the last column i want calculate the avarage for this 3 period. these should be dinamic.
if i run this query for period 0052005. query will display value for period 001 ,002 ,003,004,005 and last column will display avarage for the 5 period.
i am able to diaplay each prior period in different column that is fine. but i am not abel to calculate the avarage column.
example
selection screen :
fiscal period : 0042005
Query output
Char 0012005 0022005 0032005 0042005 Avg
88 99 77 66 (889977+66)/004
I got the resolution as bellow.
In the Characteristic Property Set it as Suppress Result Rows-> Never. For the key figure Set Calculate Result Rows-> Average of All Values.
yes it is working fine . but there is a small problem in the column heading for this colume is displying as overall result. but values are displying as a avg value. how can i change it.
why i ahve to create a text variable. please explain
Maybe you are looking for
-
Data is not getting updated in CRM
HI experts, I am updating the new address and postal codes in ISU.And now if I check these address for buisness partner in CRM. Its not getting updated. why this is happening? Is there any BDOC used in this case then how we can check that BDOC? Thank
-
Hi all, I am trying to create a report page that looks exactly like a factsheet. I have someone to help me create a CSS file, but we are not sure if we can import it to APEX and use it as a template. Do you know if it's possible to import a CSS file?
-
"View JNDI tree" link not visible under monitoring tab of myserver?
Hi, The link "View JNDI tree" as mentioned in chapter 18 of administration guide is not visibile on my installation of 6.1 beta. Is there some configuration setting that i need to do to make this link visible. I am having problems with installation a
-
HT203970 Home Sharing fix is unreliable and not permanent
Going by other posts on the Apple Forums, this fix is unreliable and not permanent... https://discussions.apple.com/thread/6601112?tstart=0 The fact that this article exists indicates that Apple are aware of the issue yet nothing has been done to res
-
Email attachment to calendar item can't be viewed in Webacc
We have a user that is posting Calendar items for his boss. He creates the item and then drags and drops an email to attach it to the meeting item. All is well in the Groupwise Client but if the Calendar item is viewed in Web Access, you can not see