Aggregation / Summing problems

Hello guys!
I am currently working on a tricky statement and don't know how to achieve a conditional summing.
I have the following statement:
SELECT decode(n.BA_KATNEW, 'hG','Heimische Gesellschaftsfremde','xi','Nebenbaumart + B + S', 'P','Pionierbaumart', 'H', 'Hauptbaumart', 'nG', 'Nicht heimische Gesellschaftsfremde') BA_FINALNAME, decode(n.BA_KATNEW, 'hG','hG','xi','N + B + S', 'P', 'P', 'H', 'H','nG','nG') BA_FINAL, n.AGGRESULT FROM (
SELECT ba_kat, ba_katnew, Calc, (sum(m.Calc) over (partition by ba_katnew)) AGGRESULT from (
SELECT
decode(ba_kat,'P','P','B','xi','N','xi','S','xi','hG','hG','H','H','nG','nG') ba_katnew, z.ba_lang, z.ba_kat, z.BA_GRUPPE, z.STR_LRT_MAIN, z.Bestand, z.Zaehlfaktor, z.Ergebnis, z.Prozent, sum(z.Ergebnis) over (partition by z.STR_LRT_MAIN) TOTAL,
round((sum(z.PROZENT) over (partition by z.ba_kat)),2) CALC
from
(select
b.ba_lang,
x.ba_kat,
p.STR_LRT_MAIN,
sum(v.DBL_Bestand) Bestand,
:P2010_ZAEHLFAKTOR_BESTAND Zaehlfaktor,
sum(v.DBL_Bestand) * :P2010_ZAEHLFAKTOR_BESTAND Ergebnis,
round(SUM(v.DBL_Bestand) * 100 / (SELECT SUM(v2.DBL_Bestand)
                                   FROM   VT_TBL_BESTAND     v2,
                                          VT_PUNKTDATEN_JOIN p2
                                   WHERE  (p2.cnt_gebiet = :P2010_cnt_GEBIET)
                                   AND    (v2.LNG_INV_PT_ID = p2.INV_PT_ID_SUB)
                                   AND    (p2.str_lrt_main = :p2010_str_lrt)
                                   AND    (p2.int_status_sub = 3)),2) AS Prozent,
decode(b.BA_GRUPPE,1,'Ba-Grp. 1',2,'Ba-Grp. 2',3,'Ba-Grp 3',4,'Ba-Grp. 4',5,'Ba-Grp. 5',6,'Ba-Grp. 6',7,'Ba-Grp. 7',8,'Ba-Grp. 8') BA_GRUPPE
from
VT_TBL_BESTAND v,
VT_PUNKTDATEN_JOIN p,
vt_tbl_baumart b,
VT_TBL_MATRIX x
where
(p.cnt_gebiet = :P2010_cnt_GEBIET)
and (v.lng_baumart = b.cnt_baumart)
and (v.LNG_INV_PT_ID = p.INV_PT_ID_SUB)
and (p.str_lrt_main = :p2010_str_lrt)
and (p.int_status_sub = 3)
and (x.LRT_CLASS=:p2010_str_lrt)
AND (x.LNG_BAUMART=v.LNG_BAUMART)
group by
b.BA_LANG,
x.BA_KAT,
BA_GRUPPE,
p.STR_LRT_MAIN) z) m group by ba_kat, ba_katnew, Calc) n GROUP BY BA_KATNEW, AGGRESULTIt produces an output such as:
BA_FINALNAME BA_FINAL AGGRESULT
"Heimische Gesellschaftsfremde"     "hG"     "3,76"
"Nebenbaumart + B + S"     "N + B + S"     "7,3"
"Pionierbaumart"     "P"     " 0,42"
"Hauptbaumart"      "H"     "88,54"
The final demand on this query is to sum AGGRESULT for the following combinations in one column:
BA_FINAL= H+N
BA_FINAL= H+N+P
BA_FINAL= N+P
and returning the AGGRESULT values for all other values in BA_FINAL as they are.
Is this even possible? I know my statement is a little confusing but I hope you're not confused and give me a chance!
I'd appreciate your help, since I don't know how to build sums over groups in one column.
Regards,
Sebastian
Edited by: skahlert on 15.10.2009 15:22

Good morning Frank!
Well, the query is working thanks to your help. However, I wanted to assign some strings to the new categorized tree species i.e. 'H', 'N+B+S' etc.
Hence I wanted to use the decode function once more but ultimately receive a group by expression error. I actually thought it should work like that? Can you please have a look at it again and tell me what I did wrong!?
By the way, thanks for teaching me how to write the code! Really appreciate it!
The line is her:
decode(x.ba_final,'N+B+S / H / P', 'Haupt- + Neben- + Pionierbaumart','N+B+S / H', 'Haupt- + Nebenbaumart incl. B+S','N / P','Nadelbaumarten² mit > 50% Anteil', 'H', 'Hauptbaumart', 'nG', 'Nicht heimische Gesellschaftsfremde', 'hG', 'Heimische Gesellschaftsfremde') ba_finalnamewhile the full code looks like:
WITH   special_grp            AS
     SELECT 'H' AS ba_final, 'N+B+S / H / P' AS grp     FROM dual     UNION ALL
     SELECT 'N + B + S', 'N+B+S / H / P'             FROM dual     UNION ALL
     SELECT 'P', 'N+B+S / H / P'             FROM dual     UNION ALL
     SELECT 'H', 'N+B+S / H'             FROM dual     UNION ALL
     SELECT 'N + B + S', 'N+B+S / H'             FROM dual     UNION ALL
     SELECT 'N', 'N / P'                  FROM dual     UNION ALL
     SELECT 'P', 'N / P'                  FROM dual UNION ALL
        SELECT 'H', 'H'                          FROM dual UNION ALL
        SELECT 'nG', 'nG'                  FROM dual UNION ALL
        SELECT 'hG', 'hG'                  FROM dual
SELECT       NVL ( s.grp
           , x.ba_final
           )               AS ba_final
,       SUM (x.aggresult)     AS aggresult, decode(x.ba_final,'N+B+S / H / P', 'Haupt- + Neben- + Pionierbaumart','N+B+S / H', 'Haupt- + Nebenbaumart incl. B+S','N / P','Nadelbaumarten² mit > 50% Anteil', 'H', 'Hauptbaumart', 'nG', 'Nicht heimische Gesellschaftsfremde', 'hG', 'Heimische Gesellschaftsfremde') ba_finalname
FROM                 (SELECT decode(n.BA_KATNEW, 'hG','Heimische Gesellschaftsfremde','xi','Nebenbaumart + B + S', 'P','Pionierbaumart', 'H', 'Hauptbaumart', 'nG', 'Nicht heimische Gesellschaftsfremde') BA_FINALNAME, decode(n.BA_KATNEW, 'hG','hG','xi','N + B + S', 'P', 'P', 'H', 'H','nG','nG') BA_FINAL, n.AGGRESULT FROM (
SELECT ba_kat, ba_katnew, Calc, (sum(m.Calc) over (partition by ba_katnew)) AGGRESULT from (
SELECT
decode(ba_kat,'P','P','B','xi','N','xi','S','xi','hG','hG','H','H','nG','nG') ba_katnew, z.ba_lang, z.ba_kat, z.BA_GRUPPE, z.STR_LRT_MAIN, z.Bestand, z.Zaehlfaktor, z.Ergebnis, z.Prozent, sum(z.Ergebnis) over (partition by z.STR_LRT_MAIN) TOTAL,
(sum(z.PROZENT) over (partition by z.ba_kat)) CALC
from
(select
b.ba_lang,
x.ba_kat,
p.STR_LRT_MAIN,
sum(v.DBL_Bestand) Bestand,
:P2010_ZAEHLFAKTOR_BESTAND Zaehlfaktor,
sum(v.DBL_Bestand) * :P2010_ZAEHLFAKTOR_BESTAND Ergebnis,
SUM(v.DBL_Bestand) * 100 / (SELECT SUM(v2.DBL_Bestand)
                                   FROM   VT_TBL_BESTAND     v2,
                                          VT_PUNKTDATEN_JOIN p2
                                   WHERE  (p2.cnt_gebiet = :P2010_cnt_GEBIET)
                                   AND    (v2.LNG_INV_PT_ID = p2.INV_PT_ID_SUB)
                                   AND    (p2.str_lrt_main = :p2010_str_lrt)
                                   AND    (p2.int_status_sub = 3)) AS Prozent,
decode(b.BA_GRUPPE,1,'Ba-Grp. 1',2,'Ba-Grp. 2',3,'Ba-Grp 3',4,'Ba-Grp. 4',5,'Ba-Grp. 5',6,'Ba-Grp. 6',7,'Ba-Grp. 7',8,'Ba-Grp. 8') BA_GRUPPE
from
VT_TBL_BESTAND v,
VT_PUNKTDATEN_JOIN p,
vt_tbl_baumart b,
VT_TBL_MATRIX x
where
(p.cnt_gebiet = :P2010_cnt_GEBIET)
and (v.lng_baumart = b.cnt_baumart)
and (v.LNG_INV_PT_ID = p.INV_PT_ID_SUB)
and (p.str_lrt_main = :p2010_str_lrt)
and (p.int_status_sub = 3)
and (x.LRT_CLASS=:p2010_str_lrt)
AND (x.LNG_BAUMART=v.LNG_BAUMART)
group by
b.BA_LANG,
x.BA_KAT,
BA_GRUPPE,
p.STR_LRT_MAIN) z) m group by ba_kat, ba_katnew, Calc) n GROUP BY BA_KATNEW, AGGRESULT
)     x
LEFT OUTER JOIN      special_grp     s     ON     s.ba_final     = x.ba_final
GROUP BY  NVL ( s.grp
           , x.ba_final
ORDER BY  UPPER (ba_final)Regards,
Sebastian

Similar Messages

  • Help PLZ Parrell Prefix Sum Problem

    i'm really stuck i need to write a parrell soultion to the prefix sum problem. i'm new 2 java and v.confused any help anybody can give would be major major help

    STFW
    http://www-2.cs.cmu.edu/afs/cs/academic/class/15251-s00/2000/Site/Materials/Lectures/lecture07/parallel.htm
    Slides 26-32 shows exactly how it could be done.
    - Marcus Sundman

  • Deletion of Total(Aggregated Sum) rows in planning book

    I want to get rid of 'Total(Aggregated Sum)' rows in planning book tables.
    'Total' line is useful but too many lines are uncomfortable for planners, so we're searching for the method not to use it.
    If you know how to configure or use macro for it, please let me know.
    Thank you,
    HyeRee

    Hi,
    I can delete totals, but I can´t delete subtotals.
    Macro Delete Totals
    IF
    New condition
       PLOBS_FOR_LEVEL( ACT_LEVEL ) = 1
    Step 1 iterations
       ROW Ratio 1
          ROW_VISIBLE( 0 )
       ROW Ratio 2
          ROW_VISIBLE( 0 )
       ROW Ratio n
          ROW_VISIBLE( 0 )
    ENDIF
    This macros works ok to deleting row totals.
    Raúl.

  • Problem aggregating sums in a while loop

    I'm relatively new to java. In my latest project, one part of the project is to translate this equation:
    [http://img.photobucket.com/albums/v281/molotov001/rt01.jpg]
    into java.
    Retaining what little knowledge I have of Calculus, this basically means that I should start with i=0, run through that function and increase i by 1 until it reaches a final number yearsWorked-1, all the while adding the functions with respect to different values of i.
    This is what I have so far
    int i = 0;
    double aime = (income * Math.pow(1.02, i) * Math.pow(1.04, (year - incYear - i)))/420;
              while (i <= (yearsWorked-1))
                   ++i;
                   double aime1 = (income * Math.pow(1.02, i) * Math.pow(1.04, (year - incYear - i)))/420;
                   aime = aime + aime1;
              }I know this is wrong because it outputs a number that is incorrect, but not by much. Also assume that income, incYear, yearsWorked and year are already defined doubles.
    Any help you might be able to offer is greatly appreciated.

    {color:#000080}Use an integer type like int or long for yearsWorked. When using double, yearsWorked - 1 may not be the exact value you expected.
    Why do you need a double value for a variable that you compare integrally anyhow?
    db{color}

  • Time Sum problems

    Hi,
    I've just managed to get a report up and going with the elapsed time between a start DateTime & Time field and a finish DateTime & Time field.  I got help from within this forum, the formula I ended up using to calculate this was:
    datetimevar x := datetime(date({VisitLog.StartedDate}),time({VisitLog.StartedTime}));
    datetimevar y := datetime(date({VisitLog.CompletedDate}),time({VisitLog.CompletedTime}));
    //  The above takes the date part of the Started (and Completed) DateTime Fields and combines it with the
    //  Time of Started and Completed Time fields, thus giving you start and complete datetimes.
    NumberVar z := datediff('s',x,y);
    //  Get the difference between the Start and Complete DateTimes in Seconds.
    totext(int(z / 3600), 0) & ":" &
    totext(abs((Remainder (z,3600)) / 60), 0);
    //  Convert the total seconds into hours and minutes.
    It's working great, however...
    Now that I have all the visits our engineers make in a week to various jobs, I need to work out the total time sent within the time period (the report is run with a date range parameter).  The problem is the normal 'sum' function won't work as it's a time value rather than a normal numerical value.
    I did have a look round the forum for other examples but I couldn't find anything to help so thought I'd once again ask the experts :o)
    An example of what I have..
    Job No.       -        Date            -            Site      -     Elapsed Time     -      Status
      1         -            01/01/09        -           CHP       -       1:0           -          complete
      2         -            01/01/09        -           Office    -       2:20         -          complete
      3         -            01/01/09        -           Office    -       1:45         -          started
      4         -            02/01/09        -           Yard      -       0.50 ;        -         complete
    I would be looking to create a total time spent using the values within the 'Elapsed Time' column.  As I say these figures are generated as per the formula above and the formula name is 'Elapsed Time'.
    Any help you can give would be greatly appreciated and once again - I'm sorry if what I'm trying to do seems pretty basic to you guys, it's been a while since I used crystal.
    Thanks,
    Kris

    Create a formula called @Seconds (basic syntax; I'm not very strong on Crystal Syntax):
    dim x, y, z
    x = datetime(date({VisitLog.StartedDate}),time({VisitLog.StartedTime}));
    y = datetime(date({VisitLog.CompletedDate}),time({VisitLog.CompletedTime}));
    z = datediff('s',x,y);
    formula = z;
    This can now be summed, or aggregated in any other way you want.
    Change your original formula above to (no need to duplicate logic...):
    totext(int({@Seconds} / 3600), 0) & ":" &
    totext(abs((Remainder ({@Seconds},3600)) / 60), 0);
    And create another formula {@Total Time} as:
    totext(int(sum({@Seconds}, {group}) / 3600), 0) & ":" &
    totext(abs((Remainder (sum({@Seconds}, {group}),3600)) / 60), 0);
    This will show the total elapsed time in HH:MM format.  (Replace "The specified item was not found." with your grouping field.)
    HTH,
    Carl

  • SUM problem in SSRS 2005 report

    I don't know how best to explain this but will try.
    In my SSRS 2005 report, i have one group in my table.  In that group, I have a field that for each company record in my dataset, this field value is repeated for each record. This is a transactions table so you'd expect several records in the dataset for each company..that's not the problem.
    example data from dataset:
    TransID     CompanyID      FeeGoal
    1                1000                  100
    2                1000                  100
    3                1000                  100
    4                2000                   400
    5                2000                   400
    My SSRS 2005 Report has:
    Group1 fields:
    CompanyID                                       FeeGoal
    =Fields!CustomerNumber.Value        =Fields!FeeGoal.Value
    The output when previewed looks like this:
    Company   FeeGoal
    1000               100
    2000               400
    Footer            209409730.83 (totals up all feegoals!  not just unique instances!)
    I have a footer, and this is where the problem comes in.  I am not able to sum 100 + 400 because if I do a SUM(=Fields!FeeGoal.Value) It doesn't just sume up 100 + 400 but rather (100 + 100 + 100) + (400 + 400)
    I can't find a way to sum up basically the top values for FeeGoal which is really what the Group Field is doing since I get 100 and 400 in my group field for feeGoal.  I should end up with a total of 500 for my footer total for Fee Goal but not sure how to get this to work in this unique situation.
    FYI: FeeGoal is an input from an ASP.NET form to allow managers to update that one column in my report so that other calculations can rely on it in my group fields.  Once the user finishes, I run a stored proc to insert that fee goal in every customer transaction record / feegoal field
    I guess is there a way to do some sort of Distinct SUM in an expression? I also tried:
    =SUM((Max(Fields!FeeGoal_AZ.Value)) / Fields!FeeSchedule.Value) * 100)
    but you can't have an aggregate function like this, I get this error:
    [rsAggregateofAggregate] The Value expression for the textbox 'GrossGoal_gt' contains an aggregate function (or RunningValue or RowNumber functions) in the argument to another aggregate function (or RunningValue). Aggregate functions cannot be nested inside other aggregate functions.
    Build complete -- 1 errors, 0 warnings
     

    Hi,
    I need to generate a SSRS 2005 report like bellow:
    OrderNumber    MultiInvoice    SalesAmt        
    TaxAmt          TotalAmt
    301256              1                     
    302                   20                  322
    369856                                    
     501                   10                  511
    359826                                    
    456                    1                    457
    785412              2                    
    725                    25                  750
    totalRow=4      totalRow=2      Sum=1984        Sum=56          
    Sum=2040 ----------------------->Footer
    --I added textbox in ther footer of that report table, and try to add expression for each, like
    1>OrderNumber : =CountRows()
    2>MultiInvoice :  =Count(column name) //but it is return no of rows,
    where it should be only 2.
    How can do that?
    3>SalesAmt : =
    SUM(Fields!SalesAmt.Value)   //It is not returning actual summation of all rows for
    SalesAmt
     column. How can I do that?
    Dipen Bhadra

  • Sum problems in Acrobat XI Pro

    I am having a problem with the sum command in Acrobat XI Pro wherby the total field is duplicating the sum of the calcualted fields, i.e ten fields are totalled and it duplicates the sum of the last 4 fields in the total fields. I have checked the calucation order is correct, but still ti will not work. Can anyone help please?

    Hi there, thanks for responding.
    Basically yes, that is my problem. I have say 10 rows and each one has a freetype box where people can enter the number of miles, the next field is a pull down list to specify a mileage rate and the last one calculates the product of the two. Then I have a total field at the bottom to sum all the totals. However, it is duplicating the totals from row two onwards, e.g. if I have two values, £12 and £15 the result returned is £42, adding the last line twice.
    I have checked the calculation order in my document and still have the same problem. I am lost......

  • Group Footer Sum Problem

    Hi Oracles!
    I am using Crystal 8.5 and I am having a problem getting a SUM in a group footer. In the column I wish to add up and place in the footer has a formula field with the following:
    Sum ({TicketDetail.packetsSold}, {Product.description})*{Product.costPrice}
    This give me a total per line of the cost but I would like to add the lines together.
    I am a novice...
    Many thanks
    David

    Hi David,
    OK got it!
    Here's what you need to do:
    1) Modify the formula to:
    whileprintingrecords;
    numbervar fin_sum;
    fin_sum := fin_sum + (Sum ({TicketDetail.packetsSold}, {Product.description})*{Product.costPrice});
    Sum ({TicketDetail.packetsSold}, {Product.description})*{Product.costPrice};
    2) Create another formula with this code and place it in the Group footer 3 section:
    whileprintingrecords;
    numbervar fin_sum;
    3) You then need a reset formula so that this sum adds up values only to the respective groups:
    whileprintingrecords;
    numbervar fin_sum := 0;
    This reset formula needs to be placed on the Group Header section. I guess in this case it will be the Group header 3.
    Let me know how this goes!
    -Abhilash

  • SUM( ) versus Aggregation SUM

    When creating a new logical column for a fact table, I can define it with an expression like SUM (column A - columnB) with aggregation rule None - column A and B being pointed to physical columns.
    On the other hand I can use an expression (column A - columnB) with aggregation rule SUM in the logical column.
    I understand that we can use either way....
    Pls. am I correct ?
    Txs.
    Antonio

    Hi Lambo,
    I can use an expression (column A - columnB) with aggregation rule SUM in the logical column. --- You can apply this way.
    Another method:-
    Open your report and add new column in your report then click FX then apply below syntax.
    sum(column A-column B). it will come out as you experted result.
    Award points it is useful.
    Thanks,
    satya

  • Value Based Dimension causing Aggrega                         tion problems

    I am new to building cubes in Oracle Olap, and am having trouble with a particular cube. (I hope I get all the terminology accurate enough to describe the problem I am having). Our organization structure is hierarchical. For example, org 0001is at the top of the "tree" and has 5 children: 1000, 2000, 3000, 40000, A000. Each of those 5 orgs have children that rollup to them. The problem is that the org "tree" is uneven. For example, Org 4000 has children that go down 4 more levels where the 3000 org only has children that go to level 3. We have about 1500 total orgs in the company. The dimension table we have shows the org_number and its Parent_org. Thus, I created an org dimension in AWM and then a value_based hierarchy. I can maintain and view the dimension in AWM and it all looks fine. I can then map the org dimension in the cube and maintain it (the cube that is). The problem is that the totals for my measures (actual costs) in the cube are way too high. Any advice as to what the problem is? I have verified that every org is in the table only once and that each org only rolls up to one parent org. I should mention that costs can be incurred by any org in the structure, no matter what level the org is at. Thanks for your help.
    Edited by: rybarrus on Jun 15, 2010 1:56 PM

    Thanks for your reply. That was a helpful suggestion. I found what seems to be the problem,but don't know why it is happening. When I look at a particular leg of the Org in the cube (in AWM) I see the following totals (indented to show parent child relationship):
    ORG--------------------Total
    1000...................602.42
    -------1030............557.48
    --------------1034.....557.48
    -------1060............ 44.94
    --------------1063..... 44.94
    When I Query the fact table I see the following totals:
    1000................... 0.00
    1030................... 159.05
    1034................... 557.48
    1060...................7,800.00
    1063................... 44.94
    To me, it looks like the total amount of the child is REPLACING the total of the parent. For example, the total in the cube for org 1060 should be 7,844.94 (7,800 + 44.94). Any reason why it doesn't sum correctly?
    Also, the total for org 1030 should be 716.53 (557.48 + 159.05).
    If you look back at my first post, I said that the overall total in the cube at the top level is way over the total in the table. That is still the case. This example that I have shown happens to be the opposite. The total I get when I query the fact table is greater than the total in the cube at this level. I hope that is not confusing.
    Edited by: rybarrus on Jun 15, 2010 4:37 PM

  • Update SPS4 to SPS10 For Solman 7.1 with SUM Problem

    Hello,
    I am trying to update SOLMAN 7.1 SPS4 to SPS10.
    I launched SUM, I have put the files Stacks ABAP & JAVA  in /usr/sap/trans/EPS/in
    I put the SUM directory in /usr/sap/SID with 60GB of size
    Now I am faced with this error:
    An error has occurred during the execution of the Validate queue step with action configure. Service com.sap.sdt.jspm.service.JspmService failed with the following message:
    Checking of deployment queue completed with error.
    You can find more information in the files /usr/sap/SID/SUM/sdt/log/SUM/VALIDATE-QUEUE_03.LOG and ProcessOverview.html.
    Use the information provided to trouble-shoot the problem. There might be an OSS note providing a solution to this problem. Search for OSS notes with the following search terms:
    SUM,configure,create-queue,validate-queue,com.sap.sdt.jspm.service.JspmService,class com.sap.sdt.jspm.service.JspmServiceException
    VALIDATE-QUEUE_03.LOG
    <!--LOGHEADER[START]/-->
    <!--HELP[Manual modification of the header may cause parsing problem!]/-->
    <!--LOGGINGVERSION[2.0.7.1006]/-->
    <!--NAME[/usr/sap/SID/SUM/sdt/log/SUM/VALIDATE-QUEUE_03.LOG]/-->
    <!--PATTERN[VALIDATE-QUEUE_03.LOG]/-->
    <!--FORMATTER[com.sap.tc.logging.TraceFormatter(%d [%6s]: %m)]/-->
    <!--ENCODING[UTF8]/-->
    <!--LOGHEADER[END]/-->
    Apr 8, 2014 3:04:10 PM [Info  ]: Validating Java development components...
    Apr 8, 2014 3:04:22 PM [Error ]: The following problem has occurred during step execution: com.sap.sdt.jspm.service.JspmServic
    eException: Checking of deployment queue completed with error.
    java.lang.NullPointerException: while trying to invoke the method com.sap.sdm.repo.Sdu.getComponent() of an object loaded from
    local variable 'sdu'
    I need your help
    Many Thanks

    Hi
    Could you refer the SAP Note
    1938098 - SUM tool fails with error java.lang.NullPointerException during VALIDATE-QUEUE
    1761799 - Software update manager failed during deployment
    Could you paste or attach the DEPLOY-COMPONENTS*.log
    Regards
    Sriram

  • Sum problem of rows because of column

    Problem...
    I have 2 row groups
    Year and QTY
    for every Year (2003,2004 etc) there are a number of cities with their own QTY
    For instance
    City1 has QTY = 20 for Year 2003
    City2 has QTY = 30 for Year 2003
    When I sum only one City1 I want the column QTY to show 20 for Year 2003 and to show 50 if both City1 and City2 are selected.
    The problem is when I sum let say City 1 it shows me 100 instead of 20 because the column group consists of 5 rows in dataset query with QTY 20, so if I sum 2 cities of the same Year it will give me 100(City1) + X(City2).   
    Did it make sense or do you need more input?

    Hi Jhonny86,,
    According to your description, you want to sum the [Qty] values for based on the selected values in the parameter.
    In your scenario, you can use DISTINCT keyword to return only distinct (different) values in query designer. Then create a tablix group on [Year] and create a city parameter. Please refer to screenshots below:
    If report deisgn above doesn't meet your requirements, please share sample data and expected results for our analysis.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • SRW224G4 and 2960 Link Aggregation LACP problem

    Hello
    WE have Linksys SRW224G4 and Cisco 2960 switches.
    We made link aggregation onboth two ports between them, all is working except that when I make continuous ping between them it fails every 90 seconds one ping. I saw the problem is , when I connect to SRW224G4 by telnet and go CTRL+Z and lcli , and login, I got console. Every 90 seconds I got this messages:
    01-Jan-2000 22:14:49 %TRUNK-W-PORTREMOVED: Port g2 removed from ch1
    01-Jan-2000 22:14:53 %TRUNK-W-PORTREMOVED: Port g1 removed from ch1
    01-Jan-2000 22:14:53 %LINK-W-Down:  ch1
    01-Jan-2000 22:14:53 %TRUNK-I-PORTADDED: Port g1 added to ch1
    01-Jan-2000 22:14:53 %LINK-I-Up:  ch1
    01-Jan-2000 22:14:56 %TRUNK-I-PORTADDED: Port g2 added to ch1
    So after this one ping fails, and it goes good next 90 seconds, and then again same group of same messages and one ping fails.
    I tried all options to change on Linksys and nothing, still i got this link down and up and one ping failed.
    Did someone had same problem, can you help me somehow.
    THank you
    Hrvoje Pastar

    Hello
    WE have Linksys SRW224G4 and Cisco 2960 switches.
    We made link aggregation onboth two ports between them, all is working except that when I make continuous ping between them it fails every 90 seconds one ping. I saw the problem is , when I connect to SRW224G4 by telnet and go CTRL+Z and lcli , and login, I got console. Every 90 seconds I got this messages:
    01-Jan-2000 22:14:49 %TRUNK-W-PORTREMOVED: Port g2 removed from ch1
    01-Jan-2000 22:14:53 %TRUNK-W-PORTREMOVED: Port g1 removed from ch1
    01-Jan-2000 22:14:53 %LINK-W-Down:  ch1
    01-Jan-2000 22:14:53 %TRUNK-I-PORTADDED: Port g1 added to ch1
    01-Jan-2000 22:14:53 %LINK-I-Up:  ch1
    01-Jan-2000 22:14:56 %TRUNK-I-PORTADDED: Port g2 added to ch1
    So after this one ping fails, and it goes good next 90 seconds, and then again same group of same messages and one ping fails.
    I tried all options to change on Linksys and nothing, still i got this link down and up and one ping failed.
    Did someone had same problem, can you help me somehow.
    THank you
    Hrvoje Pastar

  • TSTRDURAN Domain Sum Problem

    Hi Gurus;
    I use TSTRDURAN domain in my table. It use conversion routine (CONVERSION_EXIT_TSTRN_INPUT, 
    CONVERSION_EXIT_TSTRN_OUTPUT ) This domain is dec but values show as time. And I dont entry not time value. For example ; not entry 08:65:00.
    But it has very big problem. I sum some time values and it wrong calculate in alv and program. For example I want to sum (00:30
    00:30
    01:00
    00:40
    00:50
    00:20
    00:35) Sum result and show: 03:05. But should correct result 04:25.
    Maybe there is OSS note. But I dont know.
    If there any answer, please help me.
    Thanks.

    problem is data element definition, conver the values to type t....here's what works:
    data: t1 type t value '003000',
          t2 type t value '010000',
          t3 type t value '004000',
          t4 type t value '005000',
          t5 type t value '002000',
          t6 type t value '003500',
          t_result type t.
    start-of-selection.
    t_result = t1 + t1 + t2 + t3 + t4 + t5 + t6.
    write:/ t_result.
    t_result = 042500.

  • ALV SUM problem

    Hi All,
    I am using ALV grid to display report output and to sum column values i am using the DO_SUM = 'X'
    but the sum is mot populating please give any suggestions.
    Regards,
    Phani.

    Hi,
    Check My [Sample Code Here |Re: Automatic Sum At the Bottom Or At the Top of an ALV Grid]. Hope will solve out your problem,
    Best Regards,
    Faisal

Maybe you are looking for