Finding Max of Dimension values

Hi ,
I want to find the Maximum value of a parituclar dimension( ex: TopSellers dimension has values like 100,200,700,300 etc.).
What could be the query parameter that we can use while querying.
Thanks,
Unnam

Hello Unnam,
If you are in a situation where you have too many refinement values to return just for the purposes of getting the min/max values or you are using the "More..." functionality and sorting alphabetically, there is another feature that will allow you to get min/max and other values - analytics queries. This may require additional licensing from Oracle, you'll have to check.
For the details:
http://docs.oracle.com/cd/E28910_01/MDEX.622/pdf/AnalyticsGuide.pdf
Your analytics query will be very simple compared to what's in the guide above.
Analytics need to be enabled in the ./MDEX/6.X.X/conf/ProductConfig.xml file, adding the following line within the <PRODUCT_CONFIG> element:
<FEATURE NAME="Analytics API" ENABLE="TRUE"/>
The following is an example Analytics statement that can be used to capture the min and max value for the p_Fee property in a given navigation state:
RETURN FeeStmt AS SELECT MIN(p_Fee) AS MinFee, MAX(p_Fee) AS MaxFee GROUP
This statement can be added to the basic ENEQuery object in the application code as in the following example:
ENEQuery query = ...
String analyticsFeeStr = "RETURN FeeStmt AS SELECT MIN(p_Fee) AS MinFee, MAX(p_Fee) AS MaxFee GROUP";
AnalyticsQuery analytics = AnalyticsQuery.parseQuery(analyticsFeeStr);
query.setAnalyticsQuery(analytics);
The results can be retrieved from the returned Navigation object using Navigation.getAnalyticsStatementResult(), as in the following example:
Navigation nav = ...
AnalyticsStatementResult analyticsFeeResult = nav.getAnalyticsStatementResult("FeeStmt");
long numAnalyticsERecs = analyticsFeeResult.getReturnedNumERecs();
String minFee = "";
String maxFee = "";
if (numAnalyticsERecs > 0) {
ERec analyticsFeeERec = (ERec) analyticsFeeResult.getERecIter().next();
minFee = (String) analyticsFeeERec.getProperties().get("MinFee");
maxFee = (String) analyticsFeeERec.getProperties().get("MaxFee");
-Tim

Similar Messages

  • Finding Max and Min values

    Hi Gurus,
    I have a table with one column as data type NUMC of lenth 5.
    Now, I have to get the max value and minimum value from that column into two variables of same type.
    Could you please help me with the logic and code in ABAP.
    Thanks,
    Regards,
    aarthi

    select single MAX( <field> ) from table into <variable>.
    select single MIN( <field> ) from table into <variable>.
    Message was edited by:
            S B

  • Find max of 3 values

    Hello,
    I am currently performing an update using a CASE statement, however my last condition is when I'm stuck:
    UPDATE X
    SET DATE =
    CASE WHEN RATE = 'a' THEN
    DATE_IN + ((col1 / col2) * 7)
    ELSE
    CASE WHEN RATE = 'b' THEN
    DATE_IN + ((col1 / col2) * 7)
    ELSE
    CASE WHEN RATE = 'c' THEN
    DATE_IN + ((col1 / col2) * 7)
    else
    case when rate = 'd' then
    ****HERE IS THE ISSUE****
    END END END ;
    When the rate is 'd', I need to use the max of the other 3 rates.
    Any comments would be appreciated.

    shane_1004 wrote:
    Hello,
    I am currently performing an update using a CASE statement, however my last condition is when I'm stuck:
    UPDATE X
    SET DATE =
    CASE WHEN RATE = 'a' THEN
    DATE_IN + ((col1 / col2) * 7)
    ELSE
    CASE WHEN RATE = 'b' THEN
    DATE_IN + ((col1 / col2) * 7)
    ELSE
    CASE WHEN RATE = 'c' THEN
    DATE_IN + ((col1 / col2) * 7)
    else
    case when rate = 'd' then
    ****HERE IS THE ISSUE****
    END END END ;
    When the rate is 'd', I need to use the max of the other 3 rates.The "other 3 rates" are all the same:
            DATE_IN + ((col1 / col2) * 7) Assuming they were different, you could use the GREATEST function. Make sure none of the arguments to GREATEST are NULL.
    To avoid repeating some computations, you can do them in a sub-query, and refer to the column aliases in the main query. When doing an UPDATE, this will probably be slower; only you can tell if the programming convenience is worth the extra execution time.
    As Alex said, post some sample data and the results you want from that data (that is, the contents of the table after the UPDATE) if you want help.

  • Finding MAX/MIN value

    Hi!
    There are different records in PSA.
    When I load to DSO I need only max value for key figure.
    For example, data in PSA:
    Char| KF
    1| 2
    1| 5
    1| 3
    2| 1
    If I use Overwrite then result is:
    1| 3
    2| 1
    If I use Sum then result is:
    1| 10
    2| 1
    But I need followed reult:
    1| 5
    2| 1
    How can I find max value for KF without using FM or Programs?

    Hi,
    You can do this in a Start routine.
    Sort the source package and copy the records with the max value to another internal table which has the same structure as your source package.
    In the end of the routine, over write records in source package with the records in the internal table.
    THis will help.
    - Jaimin

  • Finding x and y values of a Line Chart

    Hi,
    For instance, I had a line chart with x and y axis. When I move mouse to the line chart how can I determine x and y axis values? With mouseMoved metod i can find the coordinates but coordinates doesn't help me to find x and y values of the line chart.
    How can I find x and y values of a Line Chart?
    Thanks in advance

    Translate from model to view and back. Another way to do this is to create an
    AffineTransform for the modelToView and use it to transform the points. Create an inverse
    transform to use in the viewToModel method. Add a ComponentListener and reset the transforms
    in the componentResized method to keep them updated.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.font.*;
    import java.awt.geom.*;
    import java.text.NumberFormat;
    import javax.swing.*;
    public class Translation extends JPanel {
        JLabel xLabel;
        JLabel yLabel;
        NumberFormat nf;
        double[] data = { 16.0, 32.9, 7.4, 18.9, 12.3 };
        final int Y_GRADS = 5;
        final int PAD = 35;
        final int SPAD = 3;
        final int TICK = 2;
        double maxVal;
        public Translation() {
            nf = NumberFormat.getInstance();
            nf.setMinimumFractionDigits(1);
            nf.setMaximumFractionDigits(1);
            maxVal = getMaxValue();
            addMouseMotionListener(sweep);
        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                                RenderingHints.VALUE_ANTIALIAS_ON);
            drawAxes(g2);
            plotData(g2);
        private void plotData(Graphics2D g2) {
            for(int j = 0; j < data.length; j++) {
                Point2D.Double p = modelToView(j, data[j]);
                if(j < data.length-1) {
                    Point2D.Double next = modelToView(j+1, data[j+1]);
                    g2.setPaint(Color.blue);
                    g2.draw(new Line2D.Double(p, next));
                g2.setPaint(Color.red);
                g2.fill(new Ellipse2D.Double(p.x-2, p.y-2, 4, 4));
        private Point2D.Double modelToView(double x, double y) {
            double h = getHeight();
            Point2D.Double p = new Point2D.Double();
            p.x = PAD + x*(getWidth() - 2*PAD)/(data.length-1);
            p.y = h-PAD - y*(h - 2*PAD)/maxVal;
            return p;
        public Point2D.Double viewToModel(double x, double y) {
            double h = getHeight();
            Point2D.Double p = new Point2D.Double();
            p.x = (x - PAD) * (data.length-1) / (getWidth() - 2*PAD);
            p.y = (h - PAD - y) * maxVal / (h - 2*PAD);
            return p;
        private void drawAxes(Graphics2D g2) {
            int w = getWidth();
            int h = getHeight();
            double xInc = (double)(w - 2*PAD)/(data.length-1);
            double yInc = (double)(h - 2*PAD)/Y_GRADS;
            // Abcissa
            g2.draw(new Line2D.Double(PAD, h-PAD, w-PAD, h-PAD));
            // Tick marks
            double y1 = h-PAD, y2 = y1+TICK;
            for(int j = 0; j <= data.length; j++) {
                double x = PAD + j*xInc;
                g2.draw(new Line2D.Double(x, y1, x, y2));
            // Labels
            Font font = g2.getFont().deriveFont(14f);
            g2.setFont(font);
            FontRenderContext frc = g2.getFontRenderContext();
            LineMetrics lm = font.getLineMetrics("0", frc);
            float sx, sy = h - PAD + SPAD + lm.getAscent();
            for(int j = 0; j < data.length; j++) {
                String s = String.valueOf(j);
                float width = (float)font.getStringBounds(s, frc).getWidth();
                sx = (float)(PAD + j*xInc - width/2);
                g2.drawString(s, sx, sy);
            // Ordinate
            g2.draw(new Line2D.Double(PAD, PAD, PAD, h-PAD));
            // Tick marks
            double x1 = PAD, x2 = PAD-TICK;
            for(int j = 0; j <= Y_GRADS; j++) {
                double y = PAD + j*yInc;
                g2.draw(new Line2D.Double(x1, y, x2, y));
            // Labels
            for(int j = 0; j <= data.length; j++) {
                String s = nf.format(maxVal*(1.0 - (double)j/data.length));
                float width = (float)font.getStringBounds(s, frc).getWidth();
                sx = (float)(PAD - SPAD - width);
                sy = (float)(PAD + j*yInc + lm.getAscent()/3);
                g2.drawString(s, sx, sy);
        private double getMaxValue() {
            double max = -Double.MAX_VALUE;
            for(int j = 0; j < data.length; j++) {
                if(data[j] > max) {
                    max = data[j];
            return max;
        MouseMotionListener sweep = new MouseMotionAdapter() {
            public void mouseMoved(MouseEvent e) {
                Point2D.Double p = viewToModel(e.getX(), e.getY());
                xLabel.setText(nf.format(p.x));
                yLabel.setText(nf.format(p.y));
        private JPanel getLast() {
            xLabel = new JLabel();
            yLabel = new JLabel();
            Dimension d = new Dimension(45, 25);
            JPanel panel = new JPanel(new GridBagLayout());
            GridBagConstraints gbc = new GridBagConstraints();
            gbc.insets = new Insets(2,2,2,2);
            addComponents(new JLabel("x ="), xLabel, panel, gbc, d, true);
            addComponents(new JLabel("y ="), yLabel, panel, gbc, d, false);
            return panel;
        private void addComponents(JComponent c1, JComponent c2, Container c,
                                   GridBagConstraints gbc, Dimension d, boolean b) {
            gbc.weightx = b ? 1.0 : 0;
            gbc.anchor = GridBagConstraints.EAST;
            c.add(c1, gbc);
            c2.setPreferredSize(d);
            gbc.weightx = b ? 0 : 1.0;
            gbc.anchor = GridBagConstraints.WEST;
            c.add(c2, gbc);
        public static void main(String[] args) {
            Translation test = new Translation();
            JFrame f = new JFrame();
            f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            f.getContentPane().add(test);
            f.getContentPane().add(test.getLast(), "Last");
            f.setSize(500,400);
            f.setLocation(200,200);
            f.setVisible(true);
    }

  • Dimension values display order and record details

    Hi All,
    I have explicitly ordered my dimension values to be in a logical order instead of alphabetical. Ex: Small, Medium, Large. This works great in the navigation tree but when I view a specific record and it  has those 3 dimvals they are listed in alphabetical order.
    Is there a when doing a record query to ask Endeca to respect the same display order as in the nav query?
    Thanks,
    Luc

    We are used to add two dummy records in each dimension.
    We add the following data:
    We use '-1' (surr-key) for Invalids and '-2' for Unknown.
    Easy way to populate these dimensions is to add a script together with all objects when you release new functionality. Beware you use the same descriptions.
    Even better is to think of a more general solution (more easy to maintain) and store these values in a support table. In such a table you will be able to add more columns to get more details per row. Use this reference table when you load youre dimension. Also you will find the opportunity to add more error handling cases. Especially when you add the dimension in this support table.
    Regards
    Moscowic

  • How to find max based on 2 columns.

    Hi I have a table where I have two numeric fields (date and time) )(thouse field are not date time format but numeric)
    Column A represents date and column B represent time.
    How would I find max value of column A and with results for A find Max for B.
    example
    A - - - - - - - - - -B
    101010 - - - - - 202020
    101011 - - - - - 202021
    101012 - - - - - 202021
    101010 - - - - - 202022
    101012 - - - - - 202020
    What I looking for is
    A - - - - - - - - - - B
    101012 - - - - - 202021
    Thanks

    You can try one of the following...
    sql> select * from temp;
             A          B
        101010     202020
        101011     202021
        101012     202021
        101010     202022
        101012     202020
      1  select a,b from (
      2     select a,
      3            b,
      4            rank () over (order by a desc, b desc) rnk
      5       from temp
      6* ) where rnk = 1
    sql> /
             A          B
        101012     202021
      1  select a,b from (
      2    select a,b from temp
      3       order by a desc, b desc
      4* ) where rownum = 1
    sql> /
             A          B
        101012     202021Please try to provide create table statements and insert data scripts instead of "select * from table".
    It helps creating your case easier.

  • Thread use to find max and min in an array of objects??

    Hello everyone,
    I need to find the min and max int value in a array of Objects.
    This has to be done using threads--like divide the entire array into 10 or so blocks and find the local min and max in each block., Each block is run on a thread and finally comparing them to find the global max and min.How should I do this? I am new to Java programming and in particular to threads.
    Thanks for your time and patience in answering this newbie question.
    JP

    Hi,
    if i understand your problem, you have a big array with a lot of int values and you need to create a few arrays with a part of the big one in each, next each in a thread find the max and the min, next return the max and the min of each thread and compare these max and min to obtain the globals max and min?
    In that case you can create a class in which is your big array. you create a second class implementing Runnable, in its creator you put the instance of the
    first class and 2 int which are the beginning and the ending index. in this class add a method run in this method you create a loop to compare the current value to the max and min values, and you replace if you need to do. In the first class you put the main where you create a few instance of the second class in a thread :
         private Thread threadName = new Thread(new SecondClass(this, start, end));
    Next you start all these thread:
    threadName.start();
    At the end of the run method of the second class you have to write your result in the max and min fields of the first class(int type, you have to create it)
    Write it only if it's necessary (if the current max is > than the already existing max).
    I think it's complete!
    Sorry if it's not really easy to understand, I'm french, but you can answer if you have more questions.
    S�bastien

  • Max.cond.base value - wrong line totals in Sales Order and Invoice

    Dear Experts,
        In my pricing procedure, I have set the field Max.cond.base value as 1 in VK12 (in additional data) for one of my condition type ZR16 . If Max.cond.base value is set as 1 for ZR16 condition type, the value for ZR16 will be considered only for the 1st quantity for that item. All subsequent quantities for that item will not be considered. This works fine in Sales Order and when I enter the same material in 2 line items with qty 1 each, only the first line item considers ZR16 value in total net value and the second line item does not consider the value of ZR16 in the total, which is correct.
        Problem arises when I create individual deliveries and individual invoices for each line item. Although the ZR16 value is not considered in the total for the second line item in the sales order the value is being considered in the invoice which is wrong. I tried various scenarios and found this issue arises only with domestic customer and not with overseas customer. Issue is that the line total value value calculated correctly in sales order is reflecting wrongly in Invoice when I use Max.cond.base value. I am confused if this is a pricing procedure related issue or copy control related. Please share your valuable inputs.
    Regards,
    Madhavan

    I tried various scenarios and found this issue arises only with domestic customer and not with overseas customer
    Compare the access sequence combination and condition record in both the above cases and check which one is differing and creating issue.
    the line total value value calculated correctly in sales order is reflecting wrongly in Invoice
    Again here also, compare the Analysis tab which should be self explanatory to find out the root cause of the issue.
    G. Lakshmipathi

  • New calculated member based on existing measure and a dimension value

    Hi
    I’m trying to create a new calculated member in my cube based on an existing measure and a dimension value.
    I can do it easily in DSW but I want to do it as a Calculated Member in Calculations tab from my cube.
    I have a dimension called Product in which one attribute is UOM (unit of measure) and a measure called Quantity. The relationship with the fact table is “Regular”.
    For each product we have a unit of measure and an associated quantity measure:
    Product Name   
    UOM     Quantity
    Product 1   
              Km  
             50
    Product 2   
              Kg   
             60
    Product 3   
              Kw 
              25
    Product 4              L               
    15
    Product 5              T     
             1.5
    Total                                     151.5
    The calculated member I want to create is “Kw” and has to contain the value from Quantity measure when Product.UOM is “kW” and should look like this:
    Product Name   
    UOM     Quantity   
    Kw
    Product 1   
              Km  
             50           
    Product 2   
              Kg   
             60
    Product 3   
              Kw 
              25           
     25
    Product 4              L  
                 15
    Product 5              T     
             1.5
    Total                                     151.5        
    25
    So far I tried using the MDX with “IIF” or “Case” but with no results.
    What statement I should use in this case?
    Thank you.

    Hi Cees,
    Thank you for your answer.
    I never used yet the “Scope” statement and yet it’s an elegant solution.
    I use it as in your example:
    CREATE
    MEMBER CURRENTCUBE.[Measures].[Kw]
    AS NULL,
    FORMAT_STRING =
    VISIBLE = 1 , 
    ASSOCIATED_MEASURE_GROUP =
    'TR Other';
    Scope [Measures].[Kw];
     Scope [Product].[UOM].[kW];
     This = [Measures].[Quantity];
     End
    Scope;
    End
    Scope;
    …and the calculations are solid…with one exception: when I took out UOM from the query there are no more any resuts:
    Product Name    Quantity    Kw
    Total      
    It’s only working
    if using UOM in the query.                         
    I also thought that a
    tulpe might be another solution as:
    ([Measures].[Quantity],[Product].[UOM].&[kW])
    On this last one I’ve got the expected results with one exception: when I use UOM in the query all the other UOM values are listed each one of them
    having the [Kw] measure calculation value.
    Product Name    UOM     Quantity    Kw
    Product 1              Km  
             50           
    Product 2              Kg   
             60
    Product 3              Km 
              25             25
    Product 3              Kg 
               25             25
    Product 3              Kw 
              25             25
    Product 3              L 
    25              25
    Product 3              T 
    25           
      25
    Product 4              L  
                15
    Product 5              T     
             1.5
    Total                                     151.5        
    25
    …and without UOM in the query I have what I’m expected:
    Product Name    Quantity   
    Kw
    Product 1              50           
    Product 2              60
    Product 3               25           
     25
    Product 4              
    15
    Product 5             
     1.5
    Total                       151.5        
    25
     Maybe we can work together to find a solution.
    Thank you,
    Oks

  • Best Practices - Dynamic Ranking, Dimension Values to Return, etc.

    The pinned post says non-technical questions belong on the Business Forum. I can't find an Endeca-specific business forum. If there is one, please tell me where to find it.
    My question is about dynamic ranking and the initial display of only the top N dimension values with a "More..." option to see the rest of them.
    What's the current wisdom on this from a usability point of view? Use it, don't use it? If using it, show how many values initially?
    Or, if not using it, you instead set up a hierarchy of dimensions so that the user never has to look at 50 choices for something?
    This is not a technical question. What is the current wisdom? What are the best practices?
    Thanks!

    Dynamic ranking is a good choice only if all choices cannot be further grouped. In my practice most of the content can be normalized and restricted to a very limited set of options. Dynamic ranking with "more" is an easy way out and seems like a lazy take on content management.

  • Sorting dimension values

    Is it possibe to sort dimension values in hierarchy in order diffirent from alphabetic?

    When you define a dimension you should notice on the first tab an option to set the type of dimension. The options are: User and Time. For a Time dimension you need to select type Time and this will automatically sort the members into calendar order for you. However, your source table does need to contain some additional metadata such as Time span (number of days for each time period; week=7, month=28 or29 or 30 or 31 Quarter=90 or 91 and Year = 365 or 366) and End Date for each time period. These two additional attributes are used for both sorting and to enable the time based calculations such as:
    Year To Date
    Prior Period
    Future Period
    Moving Total
    Moving Max
    Moving Min
    Does that help?
    Keith Laker
    Oracle EMEA Consulting
    OLAP Blog: http://oracleOLAP.blogspot.com/
    OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
    DM Blog: http://oracledmt.blogspot.com/
    OWB Blog : http://blogs.oracle.com/warehousebuilder/
    OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
    DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html

  • I am a rookie and need help with max and min values

    Hello all, i am into this intro to java class. my assignment is to write a program that prompts the user for two integers and then prints the sum, difference, average, product , distance (absolute value of the difference) Maximum(largest of the two) and Minimum(smallest fo the two) here is my code so far
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.lang.Math;
    public class Sample4
       public static void main(String[] args) throws IOException
          try // attempt the following
    {           // create the stream to read from
    InputStreamReader istream = new InputStreamReader(System.in);   // create a buffer to hold the stream
    BufferedReader console = new BufferedReader(istream);           // prompt the user
          System.out.println("Enter a number please");              // get input as a string
          String input = console.readLine();                        // convert to an integer
          int num1 = Integer.parseInt(input);
          System.out.println("Enter a number please");              // get input as a string
          String input2 = console.readLine();                       // convert to an integer
          int num2 = Integer.parseInt(input2);
          int sum = num1 + num2;                                    // get the sum of the two inputs
          int difference = num1 - num2;                             // get the difference of the two inputs
          int product = num1 * num2;                                // get the product of the two inputs
          int average = sum / 2;                                    // get the average of the two inputs
          int abs = Math.abs(difference);                           // get the absolute value of the two inputs
              // new section
                 // display the number
          System.out.println("The total sum = " + sum);
          System.out.println("The total difference = " + difference);
           System.out.println("The total product = " + product);
           System.out.println("The total average = " + average);
           System.out.println("The total absolute value = " + abs);
    } // if something breaks, catch the exception
    catch (IOException e)
       System.out.println(e); // displays the exception
       System.exit(1);  // quits the program
    }what will be the right syntax or code to find the MAX and MIN values of two numbers a User Inputs, hope someone can help with this. thank you for your help.

    Thanks alot man, sheesh i do not know why my book
    doesnt give me all the static methods. but i do really
    appreciate your help. peaceA complete list of the java.lang.Math methods can be found at http://java.sun.com/j2se/1.4/docs/api/java/lang/Math.html
    btw,
    max(a, b) == (a > b) ? a : b
    min(a, b) == (a < b) ? a : b

  • How To Find Opening Stock And Value For a Material

    Hi Experts,
    How To Find Opening Stock And Value For a Material  in Given Dates
    Moderator Message: Search.
    Edited by: kishan P on Sep 15, 2010 4:05 PM

    Thanks For Answering.....
    But I Need Any Function Module To Get Opening Stock And Value For Given Material With in Dates.

  • Function Module to find out the release value in contract

    Dear All,
    I have to upload the contract with new accoutn assignment without changing the existing contract. For that i have to download all the existing contract data with value.
    In that case i have some issues regarding the value.
    For example : In the system old contract is created with value 1000 and the released value as 500.
    In that case i have to uload the new contract with all the details of existing contract with value of 500 (1000-500=500).
    How can i get the value (500) and from which table.Is there any functional module to find out the release value in contract.
    Thanks and regads,
    PM
    Edited by: PM on Jan 21, 2010 8:40 AM
    Edited by: PM on Jan 22, 2010 9:48 AM

    Hi
    You need to link the table VBFA and VBAK.
    For a contract you can check all the subsequent document (which you can filter whether you want to see Order / delivery / Billing) in VBFA and then from there pick the subsequent document no. and then from VBAK you can pick the Net value of these subsequent documents, and so you will have both the values (value of Contract and value in subsequent document) and you can determine the balance value.
    Regards
    Amitesh Anand

Maybe you are looking for