Display top 10 highest values
Hi All,
Please help me on how to achieve this.
I have a report and a db prompt in my dashboard. Based on the prompt selected and given the GO button, the report gets filtered accordingly.
Now what i want is , I wanted to filter only the Top 10 values of a particular column in my report when the prompt is given go button.
For ex, say there is a report with Name, EMp No, Hours Booked and a prompt with dept column.
When a particular dept is selected from the prompt and given go, the report should display only top highest 10 values of the Hours Booked corresponding to that particular dept and not display everything.
How can i achieve this?
Regards
Gowrish
Hi,
Use the TOPN or rank functions.
TOPN (n_expression, n)
n_expression is any expression that evaluates to a numerical value.
The N of TopN which is any positive integer. It Represents the top number of rankings displayed in the result set, 1 being the highest rank.
ex:- GO-->your column and click fx--->use this function -- TOPN("Hours Booked", 10)
ex:-2
Top10 for each year--- fx---> topn(<<col>>,10,by<<col>>)<=10
Second method.----
Using rank function:
case when RANK("F1 Revenue"."1-01 Revenue (Sum All)") <= 10 then RANK("F1 Revenue"."1-01 Revenue (Sum All)"end
http://total-bi.com/2010/10/obiee-topn-versus-the-rest/
Award points it is useful.
Thanks,
satya
Edited by: satya R on Apr 27, 2012 7:48 PM
Edited by: satya R on Apr 27, 2012 9:35 PM
Similar Messages
-
Display top 5 highest salaries
Hi all..
i need to retrieve the top 5 highest salaries from the emp table please helpAn ORDER BY and ROWNUM in the same query don't do what you might think:
SQL> select empno, ename, sal
2 from emp
3 where rownum <= 5
4 order by sal;
EMPNO ENAME SAL
7369 SMITH 800
7521 WARD 1250
7654 MARTIN 1250
7499 ALLEN 1600
7566 JONES 2975
SQL> select empno, ename, sal
2 from emp
3 where rownum <= 5
4 order by sal desc;
EMPNO ENAME SAL
7566 JONES 2975
7499 ALLEN 1600
7654 MARTIN 1250
7521 WARD 1250
7369 SMITH 800These are neither the 5 highest or lowest sals.
That's because Oracle assigns rownum before the order by.
I would use dense_rank for this:
SQL> select *
2 from
3 (
4 select empno, ename, sal
5 ,dense_rank() over (order by sal desc) dr
6 from emp
7 order by sal desc
8 )
9 where dr <= 5;
EMPNO ENAME SAL DR
7839 KING 5000 1
7788 SCOTT 3000 2
7902 FORD 3000 2
7566 JONES 2975 3
7698 BLAKE 2850 4
7782 CLARK 2450 5
6 rows selected.Of course, it depends on whether you want to count 3000 twice.
Message was edited by:
SomeoneElse -
How to find top 10 highest rated documents from KM folder using search opti
Hi All,
We have requirement to display top 10 highest rated documents.
We have tried the top 10 latest documents scenario by changing default sort field as <b>cm_rating</b>.But it showing the latest rated documents not highest rated documents.
Is there any way to do this, please suggest any documents or ideas?
Thanks & Best Regards
GopalHi,
A simple method to do that is use taxonomies.
You can create un index using Trex Search and Classification service.
After that, you create its taxonomies (query based), you must create excellent, good, fair, poor and very poor folders.
Using Taxonomy Query Builder iview you classify it in this way:
Excellent folder --> IF rating is Excellent
so on....
IF rating is Good
IF rating is Fair
IF rating is Poor
IF rating is Very Poor
Then, using layout set you can show top 10 for instance.
Don't forget to active rating service in your repository.
Patricio. -
How to display top 10 values in a Webi report?
Hi,
I have the following requirement.
If the report contains 'State' and 'Revenue' columns, I need to display top 10 cities with highest revenue and the revenue of the remaining cities can be summed together and should be available in a separate cell.
I tried several formulae to achieve the requirement but was unsuccessful.
I created a variable using the formula: '= If (Rank(<State> ,<Sales revenue>)>10 ) Then Sum(<Sales revenue>) Else 0' and added it as a column in the report. This provides the required results.
When I add this variable as a column in the report, it displays 0 for the first top 10 values and only displays the remaining values. After that we can apply the Sum on this column to get the sum of the remaining (Other) sales revenue excluding top 10 values. However I cannot display this sum in a separate cell.
Please provide some suggestions on this.
Regards,
Aditya JoshiHi Aditya,
Could you please try the following solutions to resolve the issue.
Solution1:
In Oracle, there is a function called: RANK() OVER (PARTITION BY () ORDER BY ()) which can be used to define an object at Universe level to return a rank position when used in a report. If you can check with your DBA - there is a similar function available for SQL Server. It should be RANK() OVER (ORDER BY colname) AS () FROM.
Solution2:
Or you can also try returning all rows in query, apply sort at report level & apply alerter to highlight the top 10 values.
Regards,
Sarbhjeet Kaur -
ABAP Query to display top 5 employees who are having highest salary
How will you write a query in abap to display top 5 emplyeee records who are having Highest Salary Among all the employees.
Please Reply...Hi Kush,
Before writing any Database Query, always keep 2 important thumb rules in your mind :
1. Keep the number of data base access small
2. Keep the amount of data transfer small.
As you mentioned the Database Table has only 100 records, you can locally buffer the Table. So, make a local buffering and then you can sort the table based on the salary.
Select *
from Table_name
into table gt_itab.
Sort gt_itab by salary descending.
Now you can read the entries one after the another based on the index.
Have a look at the following code for an efficient performance feature. Goto SE38 and have a look at the ABAP Examples.
demo_select_some_columns. Package : SABAPDEMOS
Hope this will help.
Thanks,
Samantak. -
Query to display one row per group based on highest value
I have the following table and I want to be able to create a query that displays only the highest number based on a group. (see below)
Acode
aname
anumber
a
Jim
40
a
Jim
23
a
Jim
12
b
Sal
42
b
Sal
12
b
Sal
3
Acode
aname
anumber
a
Jim
40
b
Sal
42Multiple ways
using aggregation
SELECT Acode,aname,MAX(anumber) AS anumber
FROM table
GROUP BY Acode,aname
using subquery
SELECT Acode,aname,anumber
FROM table t
WHERE NOT EXISTS (
SELECT 1
FROM table
WHERE Acode = t.Acode
AND aname = t.aname
AND anumber > t.anumber
using analytical function
SELECT Acode,aname,anumber
FROM
SELECT *,ROW_NUMBER() OVER (PARTITION BY Acode, aname ORDER BY anumber DESC) AS Rn
FROM table
)t
WHERE Rn = 1
Please Mark This As Answer if it solved your issue
Please Vote This As Helpful if it helps to solve your issue
Visakh
My Wiki User Page
My MSDN Page
My Personal Blog
My Facebook Page -
Need to display the first 5 values of a Multi value parameter in SSRS report
Hi All,
I have SSRS report with multi value parameter. I need to display the parameter selection values in a text box. I've more than 50 records in the multi value parameter list. I've included the code to display "All" if I choose "select
all" option otherwise it will show the selected values. But, I need to change the logic. I have to show only the 1st 5 records if I choose more than 5 records.
How can I implement this?
I have used the below code
=iif(
Parameters!Country.Count = Count(Fields!Country.Value,
"Country")
,"All"
,iif(Parameters!Country.Count>5
,"Display the 1st 5 values"
,Join(Parameters!Country.Value,",")
Regards,
JulieHi Julie,
Per my understanding that you want to always show the first values from the param country to a textbox when you have select more then five values from the dropdown list, if you checked "select all", textbox will display "All", if
you select <=5 amount of values. it will display the selected values, right?
I have tested on my local environment and that you can create an hide parameter(Param2) to display just the first five values from the Country and when you select more then five values from country you will get the Join(Parameters!Param2.Value,",")
to display.
Details information below for your reference:
Create an new DataSet2 which the Param2 will get the values from:
SELECT TOP (5) Country
FROM tablename
Create an new param2 and hide this parameter, Set the "Available values" and "Default values" by select the "Get the values from a query"(DataSet2)
You can also Specify first five value for the "Available values" and "Default values", thus you will not need to follow the step1 to create the dataset2
Modify the expression you have provided as below:
=iif(Parameters!Country.Count = Count(Fields!Country.Value, "DataSet1"),"All" ,iif(Parameters!Country.Count>5 ,Join(Parameters!Param2.Value,","),Join(Parameters!Country.Value,",")))
Preview like below
If you still have any problem, please feel free to ask.
Thanks,
Vicky Liu
If you have any feedback on our support, please click
here.
Vicky Liu
TechNet Community Support -
Report results displays only (*), no numeric values.
Dear all,
The report result only displays asterick (*), no numeric values. But the field in the result thus has numbers which can be seen in display at the top in the excel sheet. why?
Do i need to make any changes in Query properties or something else??
Please advise.Hi,
You should be trying to work to different units of measure or different currency. If you do any calculation with two values which has different unit then the result will be so.
use NODIM() of the keyfigure and do the calculation. create a formula and add NODIM to keyfigure, then you should be able to see values but you will not get the unit along with value.
Else you should go for conversion of units to single one and then you can get both values and units.
Hope this helps
Regards
Akhan -
Dynamic filter to capture the highest value at runtime.
Hi,
Is there a way through which we can have a dynamic filter in Webi, which would automatically filter the maximum value from a list of values associated with a dimension object?
I have the following scenario :- I have a dimension object called 'Plan Version', whose list of values would typically be 00, 01, 02, 03.....and so on. These values are updated in the database after every 15 days. Now, in my report, i need to display the data which would be associated only to the highest 'Plan Version' value. This requires me to apply a filter on the highest value of 'Plan Version', which is not a difficult job to do if it has to be a static filter. However, I need it to be a dynamic filter, i.e., every time a new plan version is uploaded in the system, and if the report is refreshed, the report filter should automatically select (highlight) the highest value for 'Plan Version' and display the data accorsingly. One way would be to use the 'Max' function, but aggregate functions cannot be used in filters. Any help would be greatly appreciated.
Thanks,
Alok.Hey Alok,
You're correct, using Max(). But you have to apply/use it @Universe level not @Query panel.
Create Object @Universe:
Plant version = Max([Plant Version]) and make it as Dimension type.
Now use this Plane version object for Prompt @ Query level. So that it will fetch max value for the Plant Version all times.
Hope you got the logic.
Gracias...!! -
Display top,middile,bottom in prompt selection
Hi All,
i have one requirement like
I created a prompt values like top,middile,bottom
When I select top I want to display top 10 rows
if I select bottom display bottom 31st row to last row rows
and when I select middile display between 11th row to 30th row
I have total 30 rows in a column
i want case stement for the above requirement
can you please help on this issue
reg,
jel@Deep, my thoughts too!
Okay, OP, assuming you really have more than 30 rows, here is a way to look at your data in a very simple format:
1) Create a Pivot Table in the usual manner with all your attributes, facts, etc.
2) In the design mode of the Request, select another column from the Selection Pane (it doesn’t matter which because the column will be a “dummy.”) Call the column "Pagination."
3) Click on the Edit Formula icon. Type the following SQL:
CASE WHEN RCOUNT(1) <11 THEN ‘1-10’
WHEN RCOUNT(1) <31 THEN ’11-30
WHEN RCOUNT(1) >30THEN ’31 - END'
END
4) Put the Pagination column in the Page section of the Pivot Table.
Now your report is divided into the 3 sections. If you want, you could break the report into more sections and if you insist on calling the sections "Top," "Middle," and "Bottom," you can replace the labels above with those words.
You don't even need a dashboard prompt at all! -
Need to take rownum highest value without using grouping functions
Hi
I want to display highest value in the rownum column and customer details without using grouping functions like max or count
this below query gives me all rownum values and customer details
SELECT ROWNUM ROWNUM_1, CUSTOMER_NO, CUSTOMER_NAME, CUSTOMER_DOJ, CUSTOMER_MOBILENO FROM CUSTOMER;
can any one help me.The above query won't work as it's missing "from" cluase in the inner select statement.
And even if corrected it willl print rownum values thrice: value "1",max_rownum, max_rownum followed by customer details.
Below is the simple query to retrieve max row_num along with the corresponding customer details.
select * from (SELECT ROWNUM ROWNUM_1, CUSTOMER_NO, CUSTOMER_NAME, CUSTOMER_DOJ, CUSTOMER_MOBILENO FROM CUSTOMER order by rownum_1 desc) where rownum<=1 ; -
Hi Guys,
There are two Volatile Orgnaic Compounds values getting displayed, but our requirement is to get the highest value among the two values.
Please let us know if you have any solution for this.
Regards,
Rafi MohammedHi Ralph,
We have introduced the code we are able to preview the label perfectly. But when our client tries to print the label he is unable to do it.
Below is the log that we received
I000 Trace:
I000 ======
I000 02/10/12 09:16:55 Start Function 'WWI_GENERATE_LABEL'
I000 Initializing parameters
I000 Receiving data from client
I000 wait for semaphore
I000 semaphore allocated
I000 License check: I000 EH&S License verified.
I000 starting resolve for mode L
I000 Writing Result File
W000 WARNING: The height of the labelstock is too small for this amount of rows and margin. Labels may be printed on the next page.
W000 WARNING: The left edge of the shape 1036 is larger than the defined height of the label! The shape will probably not be visible on the label. Please check the template.
W000 WARNING: The right edge of the shape 1036 is larger than the defined height of the label! The shape will probably not be visible on the label. Please check the template.
W000 WARNING: Unknown rotation case! Got following data: PaperWidth=612.050009;PaperHeight=792.050012;LabelWidth=612.077000;LabelHeight=396.050000;LandscapeFlag=0
I000 GenerateLabel got 'SUCCESS' (0) as result from 'WWILABEL.DLL' and cleans up now
I000 Initializing Word connection at 02/10/12 09:16:55
I000 Initializing winword.exe process list
I000 Updating winword.exe process list
I000 Closing Word connection at 02/10/12 09:17:00
I000 process exit code: 0
I000 release semaphore
I000 Initializing result-file for OrderNo. 00000000000000001882
I000 Checking results returned from WWI in the Result-File
I000 Checking existence of generated file C:\WWI\WWI_GENSERVER_SYN_DEST\P00000000000000001882.PRN
We have analyzed it and found that there are some differences in width of the label with respect to the paper which is being used for print. But there is a statement in the log 'I000 GenerateLabel got 'SUCCESS' (0) as result from 'WWILABEL.DLL' and cleans up now', we are unable to understand this. This says the label is SUCCESS and also says WWILABEL.DLL cleans.
Could you please let us know if the label data is getting cleared once it is generated.
Regards,
Rafi -
Top 3 maximum values in a table
Dear Friends,
I'm just looking for a query to get the top 3 maximum values from a table. For example is a table contains the salary of employees, I would like to get the top 3 maximum salary. Can you please help?
Thank you in advance.
Regards,
Senthil .A. Perumal.here is a basic sample:
select emp_id, sal from employee;
EMP_ID SAL
101 2000
103 1500
102 2500
104 3000
105 2800
106 3500
107 2100
7 rows selected.
select emp.emp_id, emp.sal, emp.ranking
from (select emp_id, sal, rank() over (order by sal desc) ranking
from employee) emp
where ranking <= 3;
EMP_ID SAL RANKING
106 3500 1
104 3000 2
105 2800 3hope this helps. -
Display Currency symbol with value in ALV Report
Hi Experts,
I need to display currency symbol with value in ALV Report like if currency type is dollar then $200.
Here I am using field catalog type slis_t_fieldcat_alv and suing field merge catalog FM: 'REUSE_ALV_FIELDCATALOG_MERGE'
I tried like this
IF <fs_fieldcat>-fieldname = 'STPRS'.
<fs_fieldcat>-seltext_s = 'Std Cost '.
<fs_fieldcat>-seltext_m = 'Std Cost'.
<fs_fieldcat>-seltext_l = 'Std Cost '
<fs_fieldcat>-tabname = 'MBEW'.
<fs_fieldcat>-ctabname = 'T001'.
<fs_fieldcat>-cfieldname ='WAERS'.
<fs_fieldcat>-datatype = 'CURR'.
ENDIF.
Please any one can suggest the solution for this.
Advance Thanks.
Regards,
Bala AchariHİ,
Check this link.
http://wiki.sdn.sap.com/wiki/pages/viewpage.action?pageId=24379571
Take care.
Çağatay -
How can I display more than one value in Calendar ?
Hi,
the standard (example) script allows for the display of one value only (as I understood). How can I display two or three values, from the very same table ? Students of mine during an HTMLDB workshop in Leipzig did ask that question.
Do we have a more detailed docum. on the use of the calendar ?
pls kindly advise. TIA.
Bernhardmy solution:
Source fo the calendar starts:
snip>
declare
q varchar(32767) := null;
begin
q := 'select "ETA", <--- Date Field and concatination of fields as follows:
"SCHIFFSNAME"|| "ETA_TIME"|| "TERMINAL"||''(br*)'',
null,
null,
null,
null
from "#OWNER#"."SCHEDULE"'; . . . . . . .
snip>
comment on (br*) - you have to use "<" and ">" instead of "( " and ")" to have the "break/new line effect"
brgds
Bernhard
Maybe you are looking for
-
Installation of Solaris 10 on x86 machine
I am going to install Solaris10 5/08 on an x86 machine. After I bootup the dvd, it shows: GNU GRUB version 0.95 ( xxK lower / xxK upper memory) grub> It doesn't show the selection item reference to the following document. http://www.sun.com/software/
-
Native SQL string in Receiver JDBC
Hi All, I have a requirement where in i have to make us of message protocol : Native SQL String . SDN explanation is as follow : When inserting a line into a table the corresponding document looks as follows:* "INSERT INTO tableName (column-name1, c
-
Prolblems on Loading the data using DataMovement
Hello Sir, I have created a .dat file and want to load in the table which is created by user. Now using the Data Movement when i gives the username and password for host credentials this error is popuped. install_driver(Oracle) failed: Can't load 'D:
-
Embedding FLV or MPEG video!!???
I have the new Flash CC version. I noticed I don't have a 2014 behind it, nor do I have an option to get a 2014 version. That's all fine and dandy. Great. I'm having problems embedding flash. When I convert an MPG to a FLV, as the Adobe Encoder CC so
-
HI there, I've got given a pdf of a webpage and am now supposed to subedit this. Will I need to draw the main parts (that I have to sub) myself onto InDesign or can I use the pdf template and then fit new content into it??? Am a bit lost here and don