Report only MAX value in a query

I have two tables I'm joining, a one to many relationship exists.
1 -> Many
A -> B
I want a few columns from table A in the report, along with a couple columns from table B.
Contents of table B are:
Product
Start_Date
Last_Activity_Date
Sample of data from table B:
PRIMARY,08/24/2007,08/24/2007
PRIMARY,08/24/2008,08/20/2009
PRIMARY,08/30/2008,08/26/2009
PRIMARY,08/01/2009,08/30/2009
How do I code the query so that only the last row is returned (the one with the highest Last_Activity_Date)? I originally thought I could use MAX(Last_Activity_Date) but that isn't working.
Discoverer's original code:
SELECT /*+ FIRST_ROWS */
     A.ASSOCIATE_NO Assoc_No,
     A.CLIENT_NO Clt_No,
     A.CLIENT_NAME Clt_Name,
     A.ACTIVE_EMP_CNT EE_Cnt,
     B.START_DATE Start_Date,
     ' ' AS Filler_Col
FROM A, B
WHERE ( (A.ID = B._ID)
AND (A.ID = B.ID(+)))
AND (A.PREMIER = 'Y')
AND ( (A.STATUS IS NULL)
GROUP BY A.ASSOCIATE_NO,
     A.CLIENT_NO,
     A.CLIENT_NAME,
     A.ACTIVE_EMP_CNT,
     B.PRODUCT,
     B.START_DATE,
     B.LAST_ACTIVITY_DATE
HAVING (B.PRODUCT_NAME(+) = 'PREMIER'
AND B.LAST_ACTIVITY_DATE(+) = MAX (B.LAST_ACTIVITY_DATE(+)))
ORDER BY 1 ASC, 2 ASC;
Discoverer's code isn't working the way I want it to. It returns all rows from table B.
How can I code it so that only the row with the highest Last_Activity_Date is returned?
Thanks for all your help,
Gary F.

Hi,
There are 2 ways of doing this:
You can create a rank calculation:
rank() over (partition by client_name, client_no /* and any other columns from A */ order by last_activity_date desc)
then create a condition where your rank calculation =1.
Or you can create max calculations for each column in table B and then don't have any conditions. So for your start_date calculation you would have:
max(start_date) keep (dense_rank last order by last_activity_date)
The second method is generally the best.
Rod West

Similar Messages

  • Crystal Report Formula to select Record  of only MAX Value

    hi Everyone,
    i need a simple crystal report formula to select one department whose recived quantity Maximum.
    for example:
    itemcode    dscription      departmen   op       recived       issue        
      1                   a                ab               2              2              2         
      1                   a                bb              0             2              2          
      1                   a                bc               4             8              2         
      1                   a                cc              2              2              2
    i group by item  the item show just once but i want a formula to show one department who's recived quantity is maximum.i suppress the detail section.and just show the group footer/
    itemcode    dscription      departmen   op       recived       issue        
      1                   a                  bc                 8             14             8 

    Thanks
    Re: Crystal Report Formula to select Record  of only MAX Value
    Abhilash Kumar

  • How to get the max value in the query??

    Plant  calday(mm.dd.yyyy)       Soldout.Qty
    0001   01.01.2005               10
    0001   01.02.2005               20
    0001   01.03.2005               05
    0001   01.04.2005               16
    0001   01.05.2005               10
    0001   01.06.2005               14
        From the above values , how can i findout Max(Soldout.Qty)(i.e 20) for the above week...Suppose present aggregation = summation...How can i findout the value in the Query??don't want to do changes to design...

    Hi Bhanu,
      I tried the calculation results as...Maximum,..
      But that will pick the maximum value among the avialable values..like
    plant1 max 10
    plant2 max 20
    plant3 max 30
    then it will show as..
    plant1 max 30
    plant2 max 30
    ...like this...but my case is
    plant1 calday1 10
    plant1 calday2 05
    plan1  calday7 08
    plant2 calday1 10
    plant2 calday2 05
    plan2  calday7 20
    so for each set it need to bring the maximum value...

  • How can I show report with multi value

    Dear Maters,
    I am creating a report using BUILD A REPORT USING A DYNAMIC TEMPLATE,
    Although, I choose all product but my report only show value of revenue one product and not summary by quater, only by month.
    Detail below:
    I want to report :
    ACTUAL, Periodic     2009.Q1     2009.Q2     2009.Q3     2009.Q4     2009.TOTAL
    Revenue       7,300       232,000       20,000       140,000       465,000
    Adjusted Revenue                          
    Total Revenue      7,300       232,000       20,000       140,000       465,000
    but I only can see :
    ACTUAL, Periodic     2009.Q1     2009.Q2     2009.Q3     2009.Q4
    Revenue                     
    Adjusted Revenue                     
    How can I customize for this,
    I try using EVGST on member set but I don't know exactly what parameter on it
    Please help me?
    Thanks you so much and waiting advice from you
    Best Regards
    Chinh Pham

    Hi,
    Please refer to the EVGTS function in the below link from help.sap:
    http://help.sap.com/saphelp_bpc75_nw/helpdata/en/ef/824d0b838a4c73bd460ec9d689607f/content.htm
    You need to, basically, mention the data region from where you want to fetch the data. Depending on the template of your report, the account member comes from the row, and the time member comes from the column. So, for these 2 dimensions, you need to refer to the cells, which holds the ID of the members. For the rest of the dimensions, you should fetch the members from the page region, preferably.
    Hope this helps.

  • Need to sum max values in a report with Hidden groupings

    I have looked all over and have not found my exact situation, so I am posting my first question.  I have a report that I have grouped on multiple levels.  So my report has a customer/header/detail/release grouping.  I have written a custom
    expression so that only a single value, which is the max value in the group, is shown in the detail, with all values showing in the release.  I have then set my visibility toggle to toggle on header, then detail, then release and I need to sum up those
    max values into a field on the report.  The custom expression that I have written works correctly when you are showing on the detail level.  It gives the correct value, which is the max value in each release.
    What I then need the report to do is to sum only that max value and roll that up into the header group, so that I get a total of the max values.  
    I have tried using the MAX function in my expression to get the correct max value, but I cannot get SSRS 2008 R2 to sum that, and I have tried writing a custom expression that will calculate the max (Non-zero values divided by number of non-zero records) and
    both ways work correctly until I try to rollup and sum to the next group level.
    I have also tried using a group variable and custom code to get the value and save it to a variable, but I have not had any luck in setting or getting that value correctly back to my report.
    At its most basic it feels like I should be able to set a Sum(Max(Fields!ValueColumn.Value) and let SSRS handle how that should be broken out, but after trying that repeatedly I have still had no luck.  I cannot adjust the SQL as I need the level of detail
    that the report shows, although I could add more fields as long as I don't add any groupings or totals that would reduce the granularity of that data being returned.
    Any new avenue to explore would be very helpful.
    Thank you in advance,
    Chad
     

    Ok, after continuing to search the internet I finally found the extra piece that I was missing that gave me the results I needed. The new expression looks like this:
    =runningvalue(Sum(Max(IIF(LEFT(Fields!JobNum.Value,1)="S" AND Fields!Week1STol.Value<>0, CDBL(Fields!Week1STol.Value), 0),"JobItem"),"JobItem"),SUM, "JobItem")
    In this I wrapped the original expression of Max in both a Sum and a runningvalue both at the JobItem level to get this rollup value. Now when I open the grouping I get the correct running value at each level.
    What this really gives to me is a running total at each of four groupings, even with a "max" value at the detail level. This also allows me to total a max value inline on the report, without needing a hidden row, or report footer.
    Thank you to everyone who looked at this, I hope it helps someone else. If this answer is not clear enough, please don't hesitate to add to the comments and I will try to clarify.
    Thank you, Chad

  • Get the sum of values and show only max(Date)

    Hi,
    I have a below query and the value
    select PO_No,DATE,RCVD,LINE_QTY,QTY_INVCD,PART_NO from Purchase                         
    PO_No     DATE     RCVD LINE_QTY QTY_INVCD     PART_NO
    PO1460 12/02/2007 11     20     12     0995-13
    PO1460 13/12/2006 4     20     12     0995-13
    PO1460 05/04/2007 5     20     12     0995-13
    In the above table,
    PO_No ,Line_Qty ,Qty_INVCD,Part_No all are same value.
    Now I want the sum ( rcvd,line_qty)
    i.e.,
    Select po_no,date,sum(rcvd) over (partition by line_quantity) RCVD,line_qty,qty_invcd,part_no from Purchase
    Its look like
    PO_No     DATE     RCVD LINE_QTY QTY_INVCD     PART_NO
    PO1460 12/02/2007 20     20     12     0995-13
    PO1460 13/12/2006 20     20     12     0995-13
    PO1460 05/04/2007 20     20     12     0995-13
    Now what I want is
    I want the value for only max(Date)
    b]PO_No     DATE     RCVD LINE_QTY QTY_INVCD     PART_NO
    PO1460 05/04/2007 20     20     12     0995-13
    How will I write a query?
    Likewise I have many PO_No PO100,PO101,PO102,..........

    No need to use subquery to get this result:
    WITH data AS (select 'PO1460' po_no, to_date('12/02/2007','dd/mm/yyyy') datum, 20 recvd, 20 line_qty, 12 qty_invcd, '0995-13' part_no FROM dual
    UNION all
    select 'PO1460', TO_DATE('13/12/2006','dd/mm/yyyy'), 20, 20, 12, '0995-13' FROM dual
    UNION all
    select 'PO1460', to_date('05/04/2007','dd/mm/yyyy'), 20, 20, 12, '0995-13' FROM dual
    UNION all
    select 'PO1462', TO_DATE('13/12/2006','dd/mm/yyyy'), 30, 20, 12, '0995-13' FROM dual
    UNION all
    select 'PO1462', to_date('15/04/2007','dd/mm/yyyy'), 15, 20, 12, '0995-13' FROM dual
    UNION all
    select 'PO1462', TO_DATE('13/12/2006','dd/mm/yyyy'), 40, 20, 12, '0995-13' FROM dual
    UNION all
    select 'PO1461', to_date('15/04/2007','dd/mm/yyyy'), 15, 20, 12, '0995-13' FROM dual
    UNION all
    select 'PO1463', TO_DATE('13/12/2006','dd/mm/yyyy'), 30, 20, 12, '0995-13' FROM dual
    UNION all
    select 'PO1463', to_date('15/04/2007','dd/mm/yyyy'), 15, 20, 12, '0995-13' FROM dual
    SELECT po_no, sum(recvd) keep (dense_rank first ORDER BY datum desc)
    FROM data
    GROUP BY po_no
    will do the same

  • BI Query : Min & Max Values

    Hi all,
    I have a query regarding finding the max and min values based on Keyfigure.
    Below are the values which i get in the report.From these values i need the Max and Min value separately based on the keyfigure.
    I tried option in Aggregation tab and Calculation tab.However i am getting the Maximum value correctly whereas minimum value shows as Zero.
    0.58
    0.65
    0.88
    Please guide me and help me to resolve this issue.
    Thanks & Regards,
    Kavitha

    Hi,
    The following is the sample data.
    Calday
    Inspection Point
    P1
    Min      Max
    01.04.2014
    01.04.14-06.HRS |
    0.00
    0.58
    01.04.14-10.00HRS |
    0.00
    0.65
    01.04.14-14.00HRS |
    0.00
    0.88
    We are getting maximum value as 0.88 but min value should be 0.58 but we are getting 0.00.
    Please help me to resolve the issue

  • CHAR's value in the query but not in the report??

    Hi all,
    I loaded master data and crm transaction data from ODS to Cube. The data is in the cube but there is no value in my report when running it. EX: there are some CHARs in my report, I checked those CHARs have value in the query but it shows 'not assign' in my report when I run it. What happen?
    Thanks.
    J.

    Please see below text and also the sent link..
    If a navigation attribute is used in an aggregate, this aggregate has to be adjusted using a change run as soon as new values are loaded for the navigation attribute (when master data for the characteristic belonging to the navigation attribute is loaded.) This change run is usually one of the processes that are critical to the system performance of a production BW system. This is why, by avoiding using navigation attributes or not using navigation attributes in aggregates, you can improve the performance of this process. On the other hand, not using navigation attributes in aggregates can lead to poor query response times. The data modeler needs to find the right balance.
    http://help.sap.com/saphelp_nw04/helpdata/en/b2/e50138fede083de10000009b38f8cf/frameset.htm
    cheers,
    Vishvesh

  • Getting only Blank Values in Crystal Reports

    Hello Experts,
    I have crystal Reports on top of R/3. I am using table called EKKO, When I dragged the LIFNR (Vendor Number) in the report, It's bringing only blank values, I checked in SAP and it has 7000 records.
    For testing I created report with only this EKKO table, but the same thing, it's bringing only 91(Blank) records, I don't have any conditions or anything in my report.
    We are using Business Objects XI3.1, Crystal Reports 2008.
    Could anyone please help me?
    Thanks
    Ravi

    Yes, I created crystal report with only EKKO table. I haven't used any conditions or any parameter, I just dragged LIFNR (vendor Number) in the report and I see only blank values. When I checked in SAP, I have around 8000 records out of 91 records are blank values. So It is bringing only blank values.
    Thanks,
    Ravi

  • Query to print the max value of time of the latest record from table

    hi
    i wrote this query
    which should return max fx_time of the latest or current value of fx_date
    plz help
    this wuery is giving current date fx_date but with all values not the max value of fx_time.
    select FX_DATE, FX_TIME,FROM_CURRENCY, TO_CURRENCY, ASK_RATE, BID_RATE,
    time_stamp, source,
    DESCRIPTION, FX_TYPE, OVERRIDDEN_RATE, OVERRIDDEN_BY, OVERRIDDEN_DATE ,
    ASK_RATE_INVERSE, BID_RATE_INVERSE, PX_LAST, PX_MID, PX_OPEN, PX_HIGH,
    PX_LOW,NY_TIME_OF_LAST_PRICE_UPDATE,
    DATE_OF_LAST_UPDATE, PX_BID_AM, PX_ASK_AM, PX_BID_PM, PX_ASK_PM, PX_CLOSE_1D,
    CHG_NET_1D,
    CHG_PCT_1D, PRICING_SOURCE, PX_BID_1M, PX_ASK_1M, PX_BID_1YR, PX_ASK_1YR,
    PX_CLOSE_MTD,
    PX_CLOSE_YTD, FXOPT_COMMODITY_CCY, FXOPT_SPOT_FXRATE, SPOT_RT_USD_FLAG,
    PRIOR_CLOSE_BID,
    PRIOR_CLOSE_MID, PRIOR_CLOSE_ASK from CURRENCY_EXCHANGE_TXN
    WHERE
    source='BLOOMBERG'
    AND FX_DATE=
    (select max(fx_date) JIM from CURRENCY_EXCHANGE_TXN
    ,(select max(fx_time) TIM from CURRENCY_EXCHANGE_TXN GROUP BY FX_TIME )
    what change should i do

    Hi,
    Try this:
    select FX_DATE, FX_TIME,FROM_CURRENCY, TO_CURRENCY, ASK_RATE, BID_RATE,
    time_stamp, source,
    DESCRIPTION, FX_TYPE, OVERRIDDEN_RATE, OVERRIDDEN_BY, OVERRIDDEN_DATE ,
    ASK_RATE_INVERSE, BID_RATE_INVERSE, PX_LAST, PX_MID, PX_OPEN, PX_HIGH,
    PX_LOW,NY_TIME_OF_LAST_PRICE_UPDATE,
    DATE_OF_LAST_UPDATE, PX_BID_AM, PX_ASK_AM, PX_BID_PM, PX_ASK_PM, PX_CLOSE_1D,
    CHG_NET_1D,
    CHG_PCT_1D, PRICING_SOURCE, PX_BID_1M, PX_ASK_1M, PX_BID_1YR, PX_ASK_1YR,
    PX_CLOSE_MTD,
    PX_CLOSE_YTD, FXOPT_COMMODITY_CCY, FXOPT_SPOT_FXRATE, SPOT_RT_USD_FLAG,
    PRIOR_CLOSE_BID,
    PRIOR_CLOSE_MID, PRIOR_CLOSE_ASK from CURRENCY_EXCHANGE_TXN
    WHERE
    source='BLOOMBERG'
    AND FX_DATE=
    (select max(fx_date) JIM from CURRENCY_EXCHANGE_TXN
    FX_TIME )
    [PRE]
    Please always use [ PRE ]  and [ / PRE ] tags when ever posting any code.
    Regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Max value is same in report

    Hi Sap Experts
    I am not getting same min value from max can anyone correct my program please
    I am getting max value but in place of min I am getting the same value of max.
    I am searching with equipment range , monthly date range and unit of measurment (km,L,H)
    REPORT Z_ESLP_FUEL LINE-SIZE 200 LINE-COUNT 75
    NO STANDARD PAGE HEADING.
    TABLES : equi,
    equz,
    imptt,
    imrg,
    eqkt,
    iloa.
    Type Declaration
    TYPES: BEGIN OF ty_data ,
            equnr type equnr, " Euipment no
            eqktx type eqkt-eqktx, " Equipment Text
            eqfnr type iloa-eqfnr, " Equipment Sort field
            idate type imrg-idate, " Measuring Date
            recdu type imrg-recdu, " Unit of measuring ='KM','L','H'
            recdv type imrg-recdv, " Counter reading data
          END OF ty_data.
    TYPES: BEGIN OF ty_final,
            equnr type equnr, " Equipment no
            eqktx type eqkt-eqktx, " Equipment Text
            eqfnr type iloa-eqfnr, " Equipment Sort field
            min_date type imrg-idate, " Min Date
            min_km type p decimals 2, " Max Km
            max_km type p decimals 2, " Min km
            t_max_min_km type i, " Total min_km-max_km
            max_date type imrg-idate, " Max Date
            min_hr type imrg-recdv, " Max hr
            max_hr type imrg-recdv, " Min hr
            t_max_min_hr type i, " Total min_hr-max_hr
            min_lit type imrg-recdv, " Max lit
            max_lit type imrg-recdv, " Min lit
            t_max_min_lit type i, " Total min_lit-max_lit
            fuel_con type p decimals 2, " Total_hrs / t_max_min_hr
            km_l type p decimals 2, " km / L
            lit_per_hr type i , " fuel comsumed / t_max_min_hr
          END OF ty_final.
    DATA: i_data TYPE TABLE OF ty_data, " internal table
          wa_data TYPE ty_data, " work area
          i_final TYPE TABLE OF ty_final, " internal table
          wa_final TYPE ty_final. " work area
    data: begin of itab occurs 0,
    num type i,
    end of itab.
    data: v_min_1 type i,
    v_max_1 type i,
    min like imrg-recdv,
    max like imrg-recdv,
    max_dt like imrg-idate,
    min_dt like imrg-idate,
    t_ma_mi type p decimals 2,
    V1 LIKE  IMRG-RECDV  ,
    V2 LIKE IMRG-RECDV  .
    SELECTION-SCREEN BEGIN OF BLOCK blk WITH FRAME.
    SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS: p_equnr FOR equi-equnr ,"no-extension no intervals,
    p_idate FOR imrg-idate, "NO-EXTENSION NO INTERVALS OBLIGATORY,
    p_recdu FOR imrg-recdu. "NO-EXTENSION NO INTERVALS default 'M3'" OBLIGATORY.
    SELECTION-SCREEN END OF BLOCK blk1.
    SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE text-002.
    SELECTION-SCREEN END OF BLOCK blk2.
    SELECTION-SCREEN END OF BLOCK blk.
    TOP-OF-PAGE.
      FORMAT INTENSIFIED ON.
      WRITE:/1(40) ' INVESTMENT LIMITED '.
      WRITE:/50(40) ' FUEL CONSUMPTION REPORT ' CENTERED ,
      2 'Page', sy-pagno.
      FORMAT INTENSIFIED OFF.
      WRITE:/50(40) '----
    ' CENTERED .
      FORMAT INTENSIFIED ON.
      WRITE:/2 sy-datum COLOR 3, sy-uzeit .
      "WRITE:/1 S903-SPMON ."p_yearf.
      ULINE.
      "CENTERED.
      write: /2 'Date From :'.
      write: /2 'Equipment No :'.
      write: /2 'Unit :'.
      SKIP.
      ULINE.
      WRITE:/1 sy-vline,
      2 'EQUIP NO', 10 sy-vline,
      11 'NAME', 40 sy-vline,
      41 'min date', 50 sy-vline,
      51 'max date', 60 sy-vline,
      61 'min km', 70 sy-vline,
      71 'max km' , 80 sy-vline,
      81 't_max_min_km', 90 sy-vline,
      91 'min hr', 100 sy-vline,
      101 'max hr', 110 sy-vline,
      111 't_max_min_hr' , 120 sy-vline,
      121 'min lit', 130 sy-vline,
      131 'max lit', 140 sy-vline,
      141 't_max_min_lit', 150 sy-vline,
      151 'fuel con', 160 sy-vline,
      161 'km_l', 170 sy-vline,
      171 'lit_per_hr', 180 sy-vline.
      FORMAT COLOR 3 ON.
      ULINE.
    END-OF-PAGE.
    START-OF-SELECTION.
      select aequnr deqktx feqfnr eidate erecdu erecdv
      into table i_data
      from equi  AS a
      inner join equz as b
      on aequnr = bequnr
      inner join iloa as f
      on biloan = filoan
      inner join imptt as c
      on aobjnr = cmpobj
      inner join eqkt as d
      on aequnr = dequnr
      inner join imrg as e
      on epoint = cpoint
      where a~equnr in p_equnr
      and
      e~idate in p_idate
      and
      e~recdu in p_recdu.
        LOOP at i_data into wa_data.
             SORT i_data BY  equnr idate descending .
             "Read table i_data into wa_data index 1.
               move wa_data-recdv to max.
             SORT i_data BY  equnr idate ASCENDING .
            "Read table i_data into wa_data index 1.
               move wa_data-recdv to min.
         on change of wa_data-equnr.
         write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,wa_data-recdu ,
         'MIN',max EXPONENT 0 DECIMALS 2,
         'MAX',min EXPONENT 0 DECIMALS 2.  .
         endon.
        endloop.
        loop at i_data into wa_data.
        SORT i_data BY  equnr idate descending .
        move wa_data-recdv to max.
        endloop.
        loop at i_data into wa_data.
        SORT i_data BY  equnr idate ascending .
        move wa_data-recdv to min.
        endloop.
    regards
    Piroz

    Hi Experts
    I got the result but it is dividing in two lines one for max and another for min but I want the sub total subtraction after each max and min
    max   192300.00
    min    182139.00
    ========================
    max-min = 10161.00
    ========================
    max   649209.00
    min    642962.00
    ========================
    max-min = 6247.00
    ========================
         SORT i_data BY equnr idate descending .
    loop at i_data into wa_data.
            max = wa_data-recdv.
            min = wa_data-recdv.
    at new equnr.
            read table i_data into wa_data index sy-tabix.
            write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,'max',max EXPONENT 0 DECIMALS 2,wa_data-recdu .
            endat.
    at end of equnr.
            read table i_data into wa_data index sy-tabix.
            write:/ wa_data-equnr, wa_data-eqktx ,wa_data-eqfnr ,wa_data-idate ,'min', min EXPONENT 0 DECIMALS 2, wa_data-recdu .
    on change of wa_data-equnr.
    t_ma_mi = max - min.
    write:/ t_ma_mi.
    endon.
    endat.
    at end of equnr.
    SUM.
    write:/ '----
    endat.
    endloop.
    regards
    Piroz

  • How to display only Day value instead of DATE in Bex Report

    Hi Experts,
    We have a Month to date Report, in this report we need to display only day value instead of DATE value,
    Like
    if Date is 14.05.2010 we need to show only  14
    Regards,
    Chandra

    Hi ,
    Thanks for Quick Response
    we does have the option to create the char(calday or ...) value variable replacement with char (calday or ...) info object, we can  replace with Report r variable value only not with info object.
    i hope we can replace the with info object only with formula variable with replacement.
    My BEx Report is Designed like
    Columns
    0Calday
    Rows
    Plant
    Keyfigures
    Actual
    Plan
    Report output Looks like month to date
    0CALDAY            01.06.2010   02.06.2010  03.06.2010
    P1  ACTUAL            10                     8                    4
    P1  PLAN                 15                     6                    2
    P2  ACTUAL              5                   10                     7
    P2  PLAN                  4                      8                    3
    Report should be
    0CALDAY            1    2     3
    P1  ACTUAL      10     8      4
    P1  PLAN           15     6     2
    P2  ACTUAL        5    10    7
    P2  PLAN            4      8     3
    please let me know how can i achive this
    Regards
    Chandra

  • Query current report only and not since advertised but removing the since advertised give me multiple row

    How can i query the current report only?
    Note: The ScheduleToken is set to “Since Advertised”.
    SQL Query:
    Select
    OfferName Name, 
    Recieved, 
    Failures, 
    ProgramsStarted 'Programs Started',
    ProgramsFailure 'Program Errors', 
    ProgramsSuccess 'Program Success', 
    ProgramsFailureMIF 'Program Errors', 
    ProgramsSuccessMIF 'Program Success (MIF)', 
    PkgName Package, 
    PkgProgram Program, 
    CollectionName 'Target Collection', 
    PresentTime 'Available After',
    ExpirationTime 'Expires After',
    OfferID 'Advertisement ID'
    From vOfferStatusSummarizerRoot
    Where ScheduleToken = '0001128000080008'
    Order by OfferName

    Current report as in the latest advert?
    if yes, this should work
    Select top 1
    OfferID 'Advertisement ID',
    OfferName Name, 
    Recieved, 
    Failures, 
    ProgramsStarted 'Programs Started',
    ProgramsFailure 'Program Errors', 
    ProgramsSuccess 'Program Success', 
    ProgramsFailureMIF 'Program Errors', 
    ProgramsSuccessMIF 'Program Success (MIF)', 
    PkgName Package, 
    PkgProgram Program, 
    CollectionName 'Target Collection', 
    PresentTime 'Available After',
    ExpirationTime 'Expires After'
    From vOfferStatusSummarizerRoot
    Where ScheduleToken = '0001128000080008'
    Order by Offerid
    Blog: http://theinfraguys.com
    Follow me at Facebook
    The Infra Guys Facebook Page
    Please remember to click Mark as Answer on the answer if it helps you in anyway

  • Report required max and min value on daily basis

    Hello EXPERTS
    I have requirement to create a report. Requirement is like this. I have a dealer say d1. This dealer has 6 supervisor say sup1, sup2, sup3…..sup6. Daily they open jobcards.
    suppose on 1st march sup1 opened 6 jobcard, sup2 opened 4, sup3 8 and so on. similarly on 2nd march sup1 opened 5 sup2 6 sup4 15 and so on.
    I have all dimension and facts are available.
    The report should display this
    -------------------------------------------------- 1-Mar ---------2-Mar
    Max no of open jobcard per sup------ 8--------------- 15
    Min no of open jobcard per sup------- 4----------------- 5
    Your help will be much apriciated
    Regards

    Hello David,
    Thanks for response. But the below solution is not meeting our requirement. By doing this, it is giving the total no of Jobcard opened on a particular date.
    I have a requirement , suppose on 1st march supervisor 1 opens 20 jobcard, sup 2 opens 25 jobcards and sup 3 opens 15 jobcards. So, if i am selecting max value then my result should be like this
    March 1 --------------------------- 25
    Regards
    Niraj

  • I need that this query return only one value

    Hi, please. I need your help. I have this query:
    SELECT c.charvalue "Comentario", max(pi.id) as "id" --into :gcpe_last_comment
    FROM twflprocessinstances pi, twfliprocessparameters c
    WHERE pi.id = c.iprocess_id
    AND c.param_id = 1002286
    AND c.charvalue IS NOT NULL
    AND pi.processdef_id = 1600
    AND to_number(pi.id) <> 3817940
    AND to_number(pi.seeparameter1) =80137377
    group by c.charvalue
    having max(pi.id)
    This query return 3 rows, but I need that this query return only one row. The row that this query should return is the row before at the max id. Thanks

    Mmmm...I don't get it.
    You might need to post some sample data and expected results.

Maybe you are looking for

  • Need help with a script

    I just thought I may find someone here that could help me write a script I'm having trouble with. I'm using a 'Personal Domain' name at MobileMe. I have this Code listed below that requires the 'Formmail' free script from my provider. I don't want to

  • Starting and stopping video and MP3

    I can't seem to get around my video and audio files starting when I arrive at the page. I'm even using some example code with start and stop buttons. This is in CS4 Flash. I expect it's because the ActionScript is in the wrong place because when I ru

  • Why can't I fit my AIR app to the screen of the device ??

    Hi all, I've made some apps on device but it's the first time that I can't make the app fit the screen and I really don't understand why. I've downloaded an exemple of the game Flappy bird and I would like to play with my device. Can you help me make

  • E63 collecting mail in the middle of the night

    Hi there I have an E63 with POP3 mail account and software 500.21.009 RM437 downloaded yesterday. My network is VirginMobile in South Africa and they use the Cell C network. How do I connect and collect mail when I want to, rather than when the phone

  • Skype numbers for canada:

    Is there a reason I can't get a skype number for Canada? I have used skype for 3 years and would like to have a number for when I am in Asia.