Single row to multiple rows

Hi Gurus,
I need some suggestions. I have some comma separated values in a single row like VAL1,VAL2,VAL3,VAL4,VAL5. I need a select query which returns me rows like
VAL1
VAL2
VAL3
VAL4
VAL5.
Any help regarding this task????

Hi,
Here's one way:
SELECT     REGEXP_SUBSTR ( :str
                , '[^,]+'
                , 1
                , LEVEL
                )          AS sub_str
FROM     dual
CONNECT BY     LEVEL <= 1 + REGEXP_COUNT (:str, ',')
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data.
Explain, using specific examples, how you get those results from that data.
Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
See the forum FAQ {message:id=9360002}

Similar Messages

  • Split single row in multiple rows based on date range

    I need sql script that can split single row in multiple rows based on start date and end date column in table.
    Thank you

    I agree to your suggestion of having a dates table permanently in the database. Thats how we also do for most of our projects as well
    But in most projects the ownership  of table creation etc lies with the client as they will be the DBAs and will be design approval authorities. What I've seen is the fact that though
    many of them are in favour of having calendar table they dont generally prefer having a permanent table for numbers in the db. The best that they would agree is for creating a UDF which will have
    tally table functionality built into it based on a number range and can be used in cases where we need to multiply records as above.
    Wherever we have the freedom of doing design then I would also prefer creating it as a permanent table with required indexes as you suggested.
    >> many of them are in favour of having calendar table they dont generally prefer having a permanent table
    Those people do not understand about database and are not DBAs :-)
    It is our job to tell them what is right or wrong.
    ** This is a real story! I had a client several years back, who was the CEO of a software company.
    He use the query:
    select * from table_name
    In order to get the last ID!
    The table_name was actually a view that took data from several tables, and the main table that he wanted to get the ID included several string columns, with lot of data!
    he actually pulled all this data to the application, just to get the lat ID in a specific table!
    It is our job as Consultants or DBAs to fix's his misunderstanding :-)
      Ronen Ariely
     [Personal Site]    [Blog]    [Facebook]

  • Split single row into multiple rows containing time periods

    Hi,
    I have a table with rows like this:
    id, intime, outtime
    1, 2010-01-01 00:10, 2010-01-3 20:00
    I would like to split this row into multiple rows, 1 for each 24hr period in the record.
    i.e. The above should translate into:
    id, starttime, endtime, period
    1, 2010-01-01 00:10, 2010-01-02 00:10, 1
    1, 2010-01-02 00:10, 2010-01-03 00:10, 2
    1, 2010-01-03 00:10, 2010-01-03 20:00, 3
    The first starttime should be the intime and the last endtime should be the outtime.
    Is there a way to do this without hard-coding the 24hr periods?
    Thanks,
    Dan Scott
    http://danieljamesscott.org

    Thanks for all the feedback, Dan.
    It appears that the respective solutions provided will give you: a) different resultsets and b) different performance.
    Regarding your 'truly desired resultset' you haven't answered all questions from my previous post (there are differences in the provided examples), but anyway:
    I found that using CEIL or ROUND makes quite a difference, using my 'simple 3 record testset' (30 records vs. 66 records got initially returned, that's less than half of the original). That's quite a difference. However, I must call it a day (since it's almost midnight) for now, so there's room for more optimizement and I haven't thoroughly tested.
    But this might hopefully make a difference performancewise when compared to my previous 'dreaded example':
    SQL> drop table t;
    Table dropped.
    SQL> create table  t as
      2  select 1 id, to_date('2010-01-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-01-03 20:00', 'yyyy-mm-dd hh24:mi') outtime from dual union all
      3  select 2 id, to_date('2010-02-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-02-05 20:00', 'yyyy-mm-dd hh24:mi') outtime from dual union all
      4  select 3 id, to_date('2010-03-01 00:10', 'yyyy-mm-dd hh24:mi') intime, to_date('2010-03-03 00:10', 'yyyy-mm-dd hh24:mi') outtime from dual;
    Table created.
    SQL> select id
      2  ,      max(intime)+level-1 starttime
      3  ,      case
      4           when level = to_char(max(t.outtime), 'dd')
      5           then max(t.outtime)
      6           else max(t.intime)+level
      7         end outtime
      8  ,      level period      
      9  from   t
    10  connect by level <= round(outtime-intime)
    11  group by id, level
    12  order by 1,2;
            ID STARTTIME           OUTTIME                 PERIOD
             1 01-01-2010 00:10:00 02-01-2010 00:10:00          1
             1 02-01-2010 00:10:00 03-01-2010 00:10:00          2
             1 03-01-2010 00:10:00 03-01-2010 20:00:00          3
             2 01-02-2010 00:10:00 02-02-2010 00:10:00          1
             2 02-02-2010 00:10:00 03-02-2010 00:10:00          2
             2 03-02-2010 00:10:00 04-02-2010 00:10:00          3
             2 04-02-2010 00:10:00 05-02-2010 00:10:00          4
             2 05-02-2010 00:10:00 05-02-2010 20:00:00          5
             3 01-03-2010 00:10:00 02-03-2010 00:10:00          1
             3 02-03-2010 00:10:00 03-03-2010 00:10:00          2
    10 rows selected.
    SQL> By the way: I'm assuming you're on 10g, is that correct?
    Can you give us some information regarding the indexes present on your table?

  • Single row to multiple row

    Hi All,
    I need a help in a query to convert a row to multiple row.
    I have two tables
    TableA
    ID1 attribute1_Name attribute1_code
    ID1 attribute2_Name attribute2_code
    ID2 attribute1_Name attribute1_code
    ID2 attribute2_Name attribute2_code
    ID2 attribute3_Name attribute3_code
    ID4 attribute1_Name attribute1_code
    ID4 attribute2_Name attribute2_code
    ID4 attribute3_Name attribute3_code
    ID4 attribute4_Name attribute4_code
    attribute name and attribute code can vary 1 to n for different id
    let's one ID has maximum no of codes 20 , then TableB will have columns like (EMP ID attribuute_code1 attribuute_code2 .... attribuute_code20)
    in TableB all the columns named attribuute_code1 ..attribuute_code20 will have value for those attribute
    TableB ( )
    Column EMP ID attribuute_code1 attribuute_code2 attribuute_code3 attribuute_code4
    EMP1 ID1 attribute1_value attribute2_value null null
    EMP2 ID1 attribute1_value attribute2_value attribute3_value null
    EMP3 ID2 attribute1_value attribute2_value attribute3_value attribute4_value
    EMP and ID is composite p.k
    My resulting table should have
    EMP1 ID1 attribute1_value
    EMP1 ID1 attribute2_value
    EMP2 ID1 attribute1_value
    EMP2 ID1 attribute2_value
    EMP2 ID1 attribute3_value
    EMP3 ID2 attribute1_value
    EMP3 ID2 attribute2_value
    EMP3 ID2 attribute3_value
    EMP3 ID2 attribute4_value
    Thanks in advance ...

    hi ,
    i am using oracle 10g
    i tried the way u said , but i'm getting few uncecessary rows .
    here i am giving u the example script
    for table_A
    create table TABLE_A
    ID VARCHAR2(50),
    ATTRIBUTE_NAME VARCHAR2(50),
    ATTRIBUTE_CODE VARCHAR2(50)
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID1', 'attribute1_Name', 'attribute1_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID1', 'attribute2_Name', 'attribute2_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID2', 'attribute1_Name', 'attribute1_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID2', 'attribute2_Name', 'attribute2_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID2', 'attribute3_Name', 'attribute3_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID4', 'attribute1_Name', 'attribute1_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID4', 'attribute2_Name', 'attribute2_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID4', 'attribute3_Name', 'attribute3_code');
    insert into TABLE_A (ID, ATTRIBUTE_NAME, ATTRIBUTE_CODE)
    values ('ID4', 'attribute4_Name', 'attribute4_code');
    for table_b
    create table TABLE_B
    EMP_NAME VARCHAR2(40),
    ID VARCHAR2(50),
    ATTRIBUTE1_VALUE NUMBER,
    ATTRIBUTE2_VALUE NUMBER,
    ATTRIBUTE3_VALUE NUMBER,
    ATTRIBUTE4_VALUE NUMBER
    insert into TABLE_B (EMP_NAME, ID, ATTRIBUTE1_VALUE, ATTRIBUTE2_VALUE, ATTRIBUTE3_VALUE, ATTRIBUTE4_VALUE)
    values ('EMP1', 'ID1', 10, 20, null, null);
    insert into TABLE_B (EMP_NAME, ID, ATTRIBUTE1_VALUE, ATTRIBUTE2_VALUE, ATTRIBUTE3_VALUE, ATTRIBUTE4_VALUE)
    values ('EMP2', 'ID1', 30, 40, 50, null);
    insert into TABLE_B (EMP_NAME, ID, ATTRIBUTE1_VALUE, ATTRIBUTE2_VALUE, ATTRIBUTE3_VALUE, ATTRIBUTE4_VALUE)
    values ('EMP3', 'ID2', 60, 70, 80, 90);
    resulting table data shud come like: let it be table_c
    create table TABLE_C
    EMP_NAME VARCHAR2(50),
    ID VARCHAR2(50),
    ATTRIBUTE_CODE VARCHAR2(50),
    ATTRIBUTE_VALUE NUMBER
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP1', 'ID1', 'attribute1_code', 10);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP1', 'ID1', 'attribute2_code', 20);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP2', 'ID1', 'attribute1_code', 30);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP2', 'ID1', 'attribute2_code', 40);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP2', 'ID1', 'attribute3_code', 50);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP3', 'ID2', 'attribute1_code', 60);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP3', 'ID2', 'attribute2_code', 70);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP3', 'ID2', 'attribute3_code', 80);
    insert into TABLE_C (EMP_NAME, ID, ATTRIBUTE_CODE, ATTRIBUTE_VALUE)
    values ('EMP3', 'ID2', 'attribute4_code', 90);
    thanx

  • I need to divide selected row into multiple rows when i navigate  ADF 11g

    Hi
    I'm using jdeveloper 11.1.1.2.0 with ADF 11g.
    I need to divide selected row into multiple rows when i navigate to other page . Scenario - in first page i'm displaying some records with columns like empno , empstatus , empworkdepts ,curdepts
    Here empworkdepts gives the numeric number like no of departments work shifts 3 or 4 or 5. when i select any particular employee and fire next button to navigate next page.I have to divide the selected employee with same information into multiple times based on the empworkdepts value.
    empno empstatus empworkdepts curdept
    001 eds 2 TS
    002 hr 1 FO
    003 eds 4 TS
    *004 eds 3 TS*
    now i selected employee 004 , when i navigate to next page.
    Empno EmpStatus EmpWorkDepts CurDept
    004 eds 3 TS
    004 eds 3 TS
    004 eds 3 TS
    i did with java code in bean .but not stable .
    any help............
    thanks advance.............
    Edited by: user9010551 on May 5, 2010 10:48 PM
    Edited by: user9010551 on May 10, 2010 11:31 PM

    user9086775 wrote:
    Hi Experts,
    I have a requirment where i need to fetch parts of a single row into multiple rows from a singlt Query, i am sure it is possible using Pivots but just cant figure out an approach. Any help on this is highly appriciapted.
    Requirment:
    This is a sample set record in a table
    Product     Sub Product          Name    Age
    New Car    Nissan                   Tom        49
    New Car    Nissan                   Jack         36
    Old Car      Audi                     Sam         24
    Old Car      Jaguar                  Pint          26
    Old Car      Audi                     Smith       41
    I need to be able to fetch the above data in the below fashion
    Product     Sub Product          Name    Age
    New Car
    Nissan
    Tom        49
    Jack        36
    Old Car     
    Audi            
    Sam        24
    Smith      41
    Jaguar                   Pint         26Please help with ideas as to how can i achive the above without using PLSQL.
    Thanks in advance!You should be doing this in the client on not in the DB. Use the reporting tool that you use to do this.
    For example if you are in SQL Plus you can use the BREAK command.

  • Urgent: How to break 1 Row into Multiple Rows

    Hi Experts,
    I have a requirment where i need to fetch parts of a single row into multiple rows from a singlt Query, i am sure it is possible using Pivots but just cant figure out an approach. Any help on this is highly appriciapted.
    Requirment:
    This is a sample set record in a table
    Product Sub Product Name Age
    New Car Nissan Tom 49
    New Car Nissan Jack 36
    Old Car Audi Sam 24
    Old Car Jaguar Pint 26
    Old Car Audi Smith 41
    I need to be able to fetch the above data in the below fashion
    Product Sub Product Name Age
    New Car
    Nissan
    Tom 49
    Jack 36
    Old Car
    Audi
    Sam 24
    Smith 41
    Jaguar Pint 26
    Please help with ideas as to how can i achive the above without using PLSQL.
    Thanks in advance!

    user9086775 wrote:
    Hi Experts,
    I have a requirment where i need to fetch parts of a single row into multiple rows from a singlt Query, i am sure it is possible using Pivots but just cant figure out an approach. Any help on this is highly appriciapted.
    Requirment:
    This is a sample set record in a table
    Product     Sub Product          Name    Age
    New Car    Nissan                   Tom        49
    New Car    Nissan                   Jack         36
    Old Car      Audi                     Sam         24
    Old Car      Jaguar                  Pint          26
    Old Car      Audi                     Smith       41
    I need to be able to fetch the above data in the below fashion
    Product     Sub Product          Name    Age
    New Car
    Nissan
    Tom        49
    Jack        36
    Old Car     
    Audi            
    Sam        24
    Smith      41
    Jaguar                   Pint         26Please help with ideas as to how can i achive the above without using PLSQL.
    Thanks in advance!You should be doing this in the client on not in the DB. Use the reporting tool that you use to do this.
    For example if you are in SQL Plus you can use the BREAK command.

  • Rows to multiple rows

    Hi Tom,
    Table having huge volume of data and want to split single row to multiple rows.I mean split based on acc1 and id1
    ex:
    SELECT acc1,id1,acc2, id2 FROM TGDW_ACCT
    acc1 id1 acc2 id2
    6000161114 002 6000251684 001
    6000161115 001 6000251687 004
    Expecting o/p
    acc1 id1
    6000161114 002
    6000251684 001
    6000161115 001
    6000251687 004
    Thanks and Regards,
    MR

    Hi,
    drop table DENEME2;
    create table DENEME2 (acc1 number,id1 VARCHAR2(10),acc2 number,id2 VARCHAR2(10));
    BEGIN
    INSERT INTO DENEME2 VALUES ('6000161114','002','6000251684','001');
    INSERT INTO DENEME2 VALUES ('6000161115','001','6000251687','004');
    COMMIT;
    END;
    UYGULAMA@XE> SELECT ACC1,ID1 FROM DENEME2
    2 UNION ALL
    3 SELECT ACC2,ID2 FROM DENEME2;
    ACC1 ID1
    6000161114 002
    6000161115 001
    6000251684 001
    6000251687 004

  • How can i select some row from multiple row in the same group of data

    I want to select some row from multiple row in the same group of data.
    ColumnA        
    Column B
    1                  OK
    1                   NG
    2                   NG
    2                          NG
    3                          OK
    3                          OK
    I want the row of group of
    ColumnA if  ColumnB contain even 'NG'
    row , select only one row which  Column B = 'NG'
    the result i want = 
    ColumnA         Column B
    1                         NG
    2                   NG
    3                          OK
    Thank you

    That's some awful explanation, but I think this is what you were driving at:
    DECLARE @forumTable TABLE (a INT, b CHAR(2))
    INSERT INTO @forumTable (a, b)
    VALUES
    (1, 'OK'),(1, 'NG'),
    (2, 'NG'),(2, 'NG'),
    (3, 'OK'),(3, 'OK')
    SELECT f.a, MIN(COALESCE(f2.b,f.b)) AS b
    FROM @forumTable f
    LEFT OUTER JOIN @forumTable f2
    ON f.a = f2.a
    AND f.b <> f2.b
    GROUP BY f.a

  • Select single column but multiple rows in JTable

    Hi
    I have a jTable and want to be able to select multiple rows but only in a single column.
    I've set these properties which makes selection almost the way I would like it.
    table1.setCellSelectionEnabled(true);
    table1.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);the only problem now is that the user can select multiple columns.
    Is there a simple way to restrict selection to single column?
    regards
    abq

    table.setCellSelectionEnabled(true);
    table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    DefaultListSelectionModel model =
         (DefaultListSelectionModel)table.getColumnModel().getSelectionModel();
    model.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

  • Single Update command to update multiple rows with multiple rows

    Hi Gurus!
    Can I update table A with a result set of table b (multiple rows returns) where a.c1 = b.c1
    regards,
    SH

    As Joel mentioned this update will update all rows in a table based on another one:
    update tableA set seq_no = (select seqno from tableB where tableA.ID = tableB.ID)
    Also, any rows that don't match the select criteria will get updated to null. This could be very bad depending on what you want to do.
    To update a subset of tableA with data from tableB:
    update tableA set seq_no = (select seqno from tableB where tableA.ID = tableB.ID)
    where exists (select 1 from tableB where tableA.ID = tableB.ID)

  • SSIS + split 1 row in multiple rows based on multiple columns

    Hi all,
    I have a flat file 
    Shop ID        Check 1        Check 2            Check 3
    500 OK
    OK NOK
    I want to transform this to staging as 3 rows
    Shop ID       Check number 
    Result
    500 1
    OK
    500 2
    OK
    500 3
    NOK
    Anyone can tell me how to tackle this?

    I basically have a table that has the columns I specified
    Shop Check 1
    Check 2 Check 3
    500 OK
    OK NOK
    I now want to actually have them loaded in another table where I have multiple rows for each shop.
    Shop Check
    Result
    500
    1 ok
    500 2
    ok
    500 3
    nok
    So basically I want to go from a column view to a row view. Is this possible?
    In other words, I do see multiple rows for each shop ID which is awesome! But I would like to have instead of the result that number of the check. (1,2,3) with the result next to it :)
    500  OK
    500 OK
    500 NOK

  • Table row with multiple row

    Hi All,
    I am using NWDS 2004
    I want to have a table with multiple rows in a row.
    Can any one help ?
    Thanks

    hi Akhilesh,
    Use tree table for your requirement.
    [Tree Table Tutorial|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/de59f7c2-0401-0010-f08d-8659cef543ce]
    Hope this helps!
    Monalisa

  • 1 row into multiple rows

    I have a table time_entries
    create table time_entries
    (employee_id integer,
    start_date date,
    end_date date,
    CONSTRAINT pk_time_entries PRIMARY KEY (employee_id, start_date))Suppose I have one row in this table (dates in yyyy-mm-dd format):
    employee_id, start_date, end_date
    1, 2012-08-27, 2012-09-02
    As you can see the difference between the dates is 7 days. I want to write a query so that each day has its own row, i.e. I want to write a query which translates the above 1 row into 7 rows. This is the result set I want:
    employee_id, start_date, end_date
    1, 2012-08-27, 2012-08-27
    1, 2012-08-28, 2012-08-28
    1, 2012-08-29, 2012-08-29
    1, 2012-08-30, 2012-08-30
    1, 2012-08-31, 2012-08-31
    1, 2012-09-01, 2012-09-01
    1, 2012-09-02, 2012-09-02
    Is it possible to do it in one select statement?
    Edited by: srhcan on Aug 17, 2012 4:26 PM
    Edited by: srhcan on Aug 17, 2012 4:26 PM

    WITH t
         AS (SELECT 1 id,
                    TO_DATE ('2012-08-27', 'yyyy-mm-dd') start_date,
                    TO_DATE ('2012-09-02', 'yyyy-mm-dd') end_date
               FROM DUAL
             UNION ALL
             SELECT 2 id,
                    TO_DATE ('2012-10-27', 'yyyy-mm-dd') start_date,
                    TO_DATE ('2012-11-02', 'yyyy-mm-dd') end_date
               FROM DUAL)
    SELECT id, start_date, end_date
      FROM t
    MODEL
       PARTITION BY (id)
       DIMENSION BY (0 d)
       MEASURES (start_date, end_date, end_date stop)
       RULES
          ITERATE (10000) UNTIL start_date[ITERATION_NUMBER] = stop[0]
          (start_date [ITERATION_NUMBER] = start_date[0] + ITERATION_NUMBER,
          end_date [ITERATION_NUMBER] = start_date[0] + ITERATION_NUMBER)
    ID     START_DATE     END_DATE
    1     8/27/2012     8/27/2012
    1     8/28/2012     8/28/2012
    1     8/29/2012     8/29/2012
    1     8/30/2012     8/30/2012
    1     8/31/2012     8/31/2012
    1     9/1/2012     9/1/2012
    1     9/2/2012     9/2/2012
    2     10/27/2012     10/27/2012
    2     10/28/2012     10/28/2012
    2     10/29/2012     10/29/2012
    2     10/30/2012     10/30/2012
    2     10/31/2012     10/31/2012
    2     11/1/2012     11/1/2012
    2     11/2/2012     11/2/2012

  • View a single table-row as multiple rows in a GridControl

    Hi,
    is it possible to distribute the entries of a single row of a table/RowSetInfo over multiple lines of a GridControl?
    I've seen an example on the Internet (http://www2.gol.com/users/tame/swing/examples/JTableExamples4.html) which does this without database connection but it seems as if it's necessary to replace the default JTable, TableModel and UI by customized ones. As far as I've seen it's not possible to replace the JTable which is used by a GridControl? So is there any other way to do this? (A modification of the JTable-UI itself doesn't suffice as the JTable yields wrong row- and column-numbers on mousclick-events and therefore the components of the second row are not enabled properly).
    Thanks in advance
    null

    |I've seen an example on the Internet |(http://www2.gol.com/users/tame/swing/exampl|es/JTableExamples4.html) which does this |without database connection but it seems as |if it's necessary to replace the default |JTable, TableModel and UI by customized |ones.
    You wont be able to replace the JTable. But you can change all the attributes on the internal table which the grid uses (see getTable() method). The datamodel for the grid is impemented by oracle.dacf.control.swing.GridDataSource. You can possibly extend this class. You can also change the Table column model and the renderers used by the Table.
    |So is there any other way to do this? (A |modification of the JTable-UI itself doesn't |suffice as the JTable yields wrong row- and |column-numbers on mousclick-events and |therefore the components of the second row |are not enabled properly).
    Could you expain how the mapping between cell renderer and the table (row, col) is done in the extended JTable - which class ?.
    (http://www2.gol.com/users/tame/swing/exampl|es/JTableExamples4.html)
    null

  • How to return a single datetime from multiple rows of MAX(value) in DAX

    Hi
    I have a Results table with ResultTime, Balance, Equity which is updated with a new row every 5 minutes. I've used SUMX to find opening and closing balances and it has worked so far.
    Res_OpeningBalance:=SUMX(TOPN(1,Results,Results[ResultTime],1),[Balance])
    Res_ClosingBalance:=SUMX(TOPN(1,Results,Results[ResultTime],0),[Balance])
    But when I tried it with dates, the whole thing fell apart.
    Res_MaxBalance_Date:=SUMX(TOPN(1,Results,Results[Balance],0),[ResultTime])
    Since the highest Balance is likely to be represented through many rows due to it lasting more than 5 minutes, ResultTime (which is unique to each row) is summed up and returns messed up dates well into the future. How to return only one date (first or last
    datetime) from the rows where Balance is at max?
    I tried a TOPN of TOPN, but Excel was not amused.
    =SUMX(TOPN(1,Results,Results[Balance],0),TOPN(1,Results,Results[ResultTime],0))
    TIA!
    Re
    Dennis

    I still don't understand RANKX, but I figured it out anyway. I get the correct data by using:
    Res_MaxBalance:=MAX(Results[Balance])
    Res_MaxBalanceDate:=CALCULATE(MAX(Results[ResultTime]),FILTER(Results, Results[Balance]=MAX(Results[Balance])))
    Res_MinBalance:=MIN(Results[Balance])
    Res_MinBalanceDate:=CALCULATE(MAX(Results[ResultTime]),FILTER(Results, Results[Balance]=MIN(Results[Balance])))
    Res_MaxEquity:=MAX(Results[Equity])
    Res_MaxEquityDate:=CALCULATE(MAX(Results[ResultTime]),FILTER(Results, Results[Equity]=MAX(Results[Equity])))
    Res_MinEquity:=MIN(Results[Equity])
    Res_MinEquityDate:=CALCULATE(MAX(Results[ResultTime]),FILTER(Results, Results[Equity]=MIN(Results[Equity])))
    Re
    D

Maybe you are looking for