Use of sums in other formulas

Post Author: skootsu
CA Forum: Formula
Hello all.  I'm dealing with a huge report request that is to be output to excel.  It pulls from a inventory transaction table with tons of records.  I have  grouped by transaction type then summed and counted.  I need to take these sums and counts of each transaction type (3 types) then use these figures in other formulas.  My finished report will have 29 columns, 16 are formulas, 10 are based off these first 6 (sums&counts), the rest of the fields are flat data off the part records(like part #, description, last cost, productcode).  I'm thinking I can get all the data into one report (I was able to create a crosstab with the totals), however it will be huge and I only want to pull over the minimum needed data into the excel sheet.  Being new to Crystal Reports, I was wondering if a subreport is what might be what I need here or if I just some how can get the totals, like they appear in the crosstab, to come over so they can be used in new (summary) report?  I saw something about shared variable as well but my knowledge is limited to what I have picked up hands on.
Any tips or hints are greatly appreciated.  This is the largest report I have had to create.  My past experience is with db2, query400 and what I would normally use to accomplish this task, rpg.  I have CR9& Oracle.

Post Author: GraemeG
CA Forum: Formula
My past experience is with db2, query400 and what I would normally use to accomplish this task, rpg
Ahhh, a man after my own heart!
Just a quick warning, if you're pulling tons of data, doing loads of joins, making lots of clever calculations and summarising in all manner of ways, you may find that your report runs like a pig! The SQL Crystal generates is very clunky for starters and adding all the other bits will make developing, testing and running it quite tedious - particularly if you're new the the 'Crystal Way'. If I were you, I'd use a SQL client to figure out a cunning SQL statement that extracts and formats the data and does as many of the calculations and summaries as possible. Once you have this, use the 'Add command' bit in database expert to insert your own clean, quick and non-psychotic SQL code. This will give you something that looks like a file but contains your formatted data.
I may be shouted down for suggesting this but by doing this, I reduced the run-time for a huge extract/calculate/export-to-excel report from 12 minutes down to 18 seconds and made a bunch of the other reports acceptable in the users eyes by reducing the run-speeds dramatically.
Fair enough, the SQL statements are not simple but they run quickly and accurately and thats what counts. If you do decide to give this a try and need a hand, let me know.
BTW, why wouldn't you use RPG to do this?

Similar Messages

  • How to use total/sum of values obtaind by applying formula on restricted KF

    Hi all
    I am using formula on restricted keyfigure i.e I want to apply formula on quantity for particular material say 100007,100990.I want to use total of values in some other formula,obtained by aaplyin formula on their respective quantities(obtained by using restricted keyfigure). if I use SUMCT or SUMGT it is not taking total of these 2 values instead taking value obtained by applying formula on result row.
    Is there any other way to use this 'total ' value in some other formula
    KIindly help
    Regards
    Megha

    have you tried: key figure properties -> calculations -> calculation directions
    hope it helps,
    Leo

  • Summarizing Three (3) Formulas (When Using "Sum" Within Each Formula)

    I'm getting an error (i.e. 'This field cannot be summarized.") when
    trying to summarize three (3) formulas.  I figured out that it is
    probably because that there is a "Sum" in each formula.  I need totals
    only for specific officers (not all officers). Can someone tell me how
    to accomplish this ?  Thanks  ! ! !
    Formula #1
    NumberVar PeteTotal;
    PeteTotal := 0;
    If = "Pete"  And
       <> ["5001", "5030", "5031", "5032"] Then
       PeteTotal := Sum (, )
    Formula #2
    NumberVar MikeTotal;
    MikeTotal := 0;
    If = "Mike"  And
       <> ["5001", "5030", "5031", "5032"] Then
       MikeTotal := Sum (, )
    Formula #3
    NumberVar TonyTotal;
    TonyTotal := 0;
    If = "Tony"  And
       <> ["5001", "5030", "5031", "5032"] Then
       TonyTotal := Sum (, )
    Formula #4
    NumberVar AllTotals;
    AllTotals :=0;
    AllTotals := Sum(@PeteTotal, @MikeTotal, @TonyTotal)

    I got zeros . . .  below is the code  . . .  do you see anything wrong ?
    Formula #1
    NumberVar Total;
    Total := 0;
    Whilereadingrecords;
    If in ["Pete","Mike","Tony"]  And
       in ["5001", "5030", "5031", "5032"] Then
       Total :=
    Else
    0;
    Formula #2
    NumberVar GroupTotal;
    GroupTotal := 0;
    GroupTotal := Sum({@Formula #1});

  • How to use cumulative Value in a formula

    Hello Gurus,
    I would like to use the cumulative value in a query as part of a formula calculation. I have created a KF which is assigned a constant value 1. When displaying the KF I am cumulating it so for each row I am getting 1,2,3,4...etc. How can I use this cumulated value in a formula calculation?
    For example, in a column cumulative count is 1,2,3,4...etc .My requirement is ,i want to identify the record with number 36 , to do this i have created a formula with boolean Equal to function comparing with the required number, but the boolean result what am i getting is Zero instead of one(1).
    The reason i found behind the problem is, the cumulative count that we see is dynamically happening during the run time for display ,but the internal value is 1 only.
    Is there any other way to meet this requirement or am i missing anypoint?.
    Thanks.

    Dear Yaseen,
                To get the value in formula cumulative,after you have created the formula for that particular key figure,go to edit and click on tab "calculations".
    In that select overall result as 'count all values not equal to zero' and single result as 'count all values not equal to zero' .
    And mark the cumulative check box underneath.
    I hope you get the desired result and please do me favour .
    Sumit goomber

  • Global variable not being seen by other formulas

    Hi
    I've set a global variable in my report, but other formulas don't recognise it. What have I done wrong?
    In my group1 header I have a formula 'w' which is just
    Global Numbervar v1 := 0;
    In my details section I have a formula 'x' which is
    if {Command.INVLINETYPE} = 1 and previous({Command.INVLINETYPE}) <> 999 then
       {Command.LINEVALUE};
        v1 := v1 + {Command.LINEVALUE};
    else
    if {Command.INVLINETYPE} = 999 and {Command.ORDERNO} <> previous({Command.ORDERNO}) then
       {Command.LINEVALUE}
    else
       0
    this gives an error of 'Missing ) ' when I try to save it. If I put in a local variable in place of v1, the formula saves. This is the first time I've used variables in this way, which I'm having to do to try to sum this formula which uses Previous. Thought that I could create a global variable and use it to record the total.
    Thanks
    Steven

    Sharon
    thanks for this. Unfortunately I get the same when I move the ).
    Is it something to do with where the Global variable is declared (though I have tried moving it around).
    Regards
    Steven

  • How to use user variable in Member Formula

    Hi All
    I have to write a member formula for %linearity quarter for a weekly application.This member will be used in reports and we do not want to do this calculation in reports, hence need to write member formula. The formula is
    Week1 of Q1 forecast / Q1 Total Forecast , Week2 of Q1 Forecast/ Q1 Forecast.............,Week15 of Q2 forecast/ Q2Total Forecast.......and so on.
    According to me it should work in the below mentioned manner , but need help in improvising the formula.
    If(@ismbr("Weeks1") or @ismbr("Weeks2") or @ismbr("Weeks3") or @ismbr("Weeks4") or @ismbr("Weeks5") or @ismbr("Weeks6") or @ismbr("Weeks7") or @ismbr("Weeks8") or @ismbr("Weeks9") or @ismbr("Weeks10") or @ismbr("Weeks11") or @ismbr("Weeks12") or @ismbr("Weeks13") or @ismbr("Weeks14") )
    "Current_Forecast"/"Q1"->"Current_Forecast";......
    If anybody can help in suggesting how can i use user variable in this formula to achieve the required result.
    Thanks

    Hi
    Thanks for the suggestion and it would be a better idea to use ISIDESC as compared to ISMBR.
    I also wanted to ask if in the below mentioned formula if the result of first line is true than will the second line pick the current_forecast value of the respective member of Q1 and divide it by the current_forecast value of Q1.
    IF(@ISIDESC("Q1"))
    "Current_Forecast"/"Q1"->"Current_Forecast";
    Also i need to know how can i write a member formula for week YOY% using user variables.The general formula is
    Week 1 of FY13 - Week 1 of FY12/Weeks 1 of FY12
    Week 2 of FY13 - Week 2 of FY12/Weeks 2 of FY13 and so on till week 53.
    Thanks

  • How to use the distinct key in formula field in SAP Crystal Reports

    I want to use the distinct key in formula field in SAP Crystal reports.
    When i'm using it shows an error.
    Please suggest me....

    Hi,
    Use DistinctCount keyword directly for your calculation instead of count(distinct(....
    Alternatively, if you want to avoid duplicate records, under "File" > "Report Options" make the 'Select Distinct Records' as True.
    Thanks,
    Raghavendra

  • How do you use a column title Ina formula in numbers

    How do you use a column title in a formula in numbers ie. "cost" vs. F-1?

    Have you tried here?   This isn't specifically a "Using iPad" question.

  • Use of array in multiple formulas

    I need to set up a array that I will use in multiple formulas.
    Can I create it as a global or shared value in one formula, set the values of the array and then use that array in another formula.  I don't want to have to reset all the values in the array each time I need to use it.
    Do I have to specify "WhilePrintingRecords"?  Also do I have to include the formula that sets up the array on the report.
    Thanks
    Russ

    Hi Russell,
    We can use array to create an ordered list and we can use it in other formulas. We can create them global or shared to use in the same report or in the sub report. You can use "WhilePrintingRecordsu2019 only if you want to push the execution of the formula in the last pass of execution otherwise it is not necessay.
    To get details about its use open crystal reports help under help menu and type in array in index tab.
    Hope this helps,
    Regards,
    Aditya Joshi

  • Used of 362 & 363 Alternative formula for condition base value in Define Procedures (Tcode obyz)

    Dear
             what is the  used of 362 & 363 Alternative formula for condition base value in Define Procedures (Tcode obyz)

    362 is used for to pick base value to BASB condition type from MM pricing procedure
    363 is used for all sales tax {VAT (Inventory or set -off) & CST}.
    Tax Calculation on Freight - Different Scenarios
    Please  go through this  link  and  you will know  very well a bout  362 and  363  usage

  • I use Function Sum to add a column and a new column pops up filled with 0s

    In one of my spreadsheets, every time I try to add a column of numbers using the Sum Function, a new column is added filled with 0s. What's happening? And How do I get it to just add the column?

    can't you just write an SQL script to update the new column?
    Perhaps you can use the integration_id for this? or just another column(s)..

  • Set Measure column "Aggregation Rule" to "sum" or other,return error

    when set a Measure column "Aggregation Rule" to "sum" or other,return error,as following:
    View Display Error
    Odbc driver returned an error (SQLExecDirectW).
    Error Details
    Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 43113] Message returned from OBIS. [nQSError: 46008] Internal error: File server\Query\Optimizer\Request\Src\SQORRqList.cpp, line 285. (HY000)
    SQL Issued: SELECT s_0, s_1, s_2, s_3, s_4, s_5, s_6, s_7, s_8, s_9, s_10, s_11, s_12, s_13 FROM ( SELECT 0 s_0, "SPW_PRO"."Product"."FamilyGroupName" s_1, "SPW_PRO"."Product"."Gen4,Product" s_2, "SPW_PRO"."Product"."MajorGroupName" s_3, "SPW_PRO"."Product"."ProductName" s_4, SORTKEY("SPW_PRO"."Product"."Gen4,Product") s_5, "SPW_PRO"."SPWPRODB"."Sales" s_6, "SPW_PRO"."SPWPRODB"."Sales%" s_7, "SPW_PRO"."SPWPRODB"."产品运营天数" s_8, "SPW_PRO"."SPWPRODB"."售卖数量" s_9, REPORT_AGGREGATE("SPW_PRO"."SPWPRODB"."Sales" BY "SPW_PRO"."Product"."FamilyGroupName","SPW_PRO"."Product"."MajorGroupName") s_10, REPORT_AGGREGATE("SPW_PRO"."SPWPRODB"."Sales%" BY "SPW_PRO"."Product"."FamilyGroupName","SPW_PRO"."Product"."MajorGroupName") s_11, REPORT_AGGREGATE("SPW_PRO"."SPWPRODB"."产品运营天数" BY "SPW_PRO"."Product"."FamilyGroupName","SPW_PRO"."Product"."MajorGroupName") s_12, REPORT_MAX("SPW_PRO"."SPWPRODB"."售卖数量" BY "SPW_PRO"."Product"."FamilyGroupName","SPW_PRO"."Product"."MajorGroupName") s_13 FROM "SPW_PRO" WHERE (("Period"."Gen5,Period" IN (SELECT saw_1 FROM (SELECT "Period"."OperatingDaily" saw_0, "Period"."Gen5,Period" saw_1, "Year"."Gen2,Year" saw_2 FROM "SPW_PRO") nqw_1 )) AND ("Year"."Gen2,Year" IN (SELECT saw_2 FROM (SELECT "Period"."OperatingDaily" saw_0, "Period"."Gen5,Period" saw_1, "Year"."Gen2,Year" saw_2 FROM "SPW_PRO") nqw_1 ))) ) djm
    please help me . Thanks a lot.

    Thanks dnikiforov
    still get the
    select a.rmdept||a.rmstyl||a.rmcolr||a.rmsize||','||a.rmvatc||','||a.rmshgp||','||rmdesc||','||rmac
    ERROR at line 1:
    ORA-00904: invalid column name
    I think its a problem with trying to select on the unique, anyway I accidentally posted a couple of threads for this and it has now been resolved by
    select a.rmdept||a.rmstyl||a.rmcolr||a.rmsize||','||a.rmvatc||','||a.rmshgp||','||
    a.rmdesc||',||a.rmacod||','||a.rmcdes||','||a.rmzdes||','||a.rmsupp||','||a.rmsspr||','||a.rmlcos||','||
    c.rsbarc||','||a.rmpord||','||a.rmmrch||','||a.rmcomq||','||sum(b.rdcstk)
    from stkmas a, stkwar b, stkbar c
    where a.rmdept = c.rsdept(+)
    and a.rmstyl = c.rsstyl(+)
    and a.rmcolr = c.rscolr(+)
    and a.rmsize = c.rssize(+)
    and a.rmdept = b.rddept(+)
    and a.rmstyl = b.rdstyl(+)
    and a.rmcolr = b.rdcolr(+)
    and a.rmsize = b.rdsize(+)
    group by a.rmdept,a.rmstyl,a.rmcolr,a.rmsize,a.rmvatc,a.rmshgp,
    a.rmdesc,a.rmacod,a.rmcdes,a.rmzdes,a.rmsupp,a.rmsspr, a.rmlcos,
    c.rsbarc,a.rmpord,a.rmmrch,a.rmcomq
    as I dont need to use the unique because the sum does it for me
    Thanks again for speedy help

  • Is variable offsets can be used for characteristics, text and formulas?

    hi all,
    can anyone let me know whether variable offsets can be used for characteristics, text and formulas.
    if so cany one send me examples of using offsets to my email id [email protected]
    regds
    hari

    You use offsets on dates (0CALMONTH, 0FISCYEAR, 0DAT and so on) and of course the corresponding texts.
    If you have 0CALMONTH in your query and you want to do the same thing not only for the current month but for the past twelve months, they you just minus 1, 2....11,12 for each selections, and at the same time you can create text variable for the description of each month.
    thanks.
    Wond

  • How do I set upmy Imac to allow using both my computer speakers and a Bose SoundLink system as outputs at the same time.  I can use one or the other, but not both.

    how do I set up my Imac to allow using both my computer speakers and a Bose SoundLink system as outputs at the same time.  I can use one or the other, but not both.  From systems Preferences I must select one or the other.  I want both to work all the time.

    Hi,
    I would recommend you to use 0FI_AP_4 rather using both, particularly for many reasons -
    1. DS: 0FI_AP_4  replaces DataSource 0FI_AP_3 and still uses the same extraction structure. For more details refer to the OSS note 410797.
    2. You can run the 0FI_AP_4 independent of any other FI datasources like 0FI_AR_4 and 0FI_GL_4 or even 0FI_GL_14. For more details refer to the OSS note: 551044.
    3. Map the 0FI_AP_4 to DSO: 0FIAP_O03 (or create a Z one as per your requirement).
    4. Load the same to a InfoCube (0FIAP_C03).
    Hope this helps.
    Thanks.
    Nazeer

  • When I select a netflix movie on my iPad and push it to my apple TV, why doesn't the Apple TV take over the streaming, so that I can then use my iPad for other things?

    From what I can tell, when I select the movie and hit the airplay button to move it to the apple TV, my iPad is still doing all the work of streaming the movie.  Why can't the apple TV take over the heavy work at this point?  I'd like to be able to use my iPad as more of a remote with an awesome interface for the apple TV.  The netflix app on iPad is great, and the easiest way to browse movies, and pushing them to the apple TV is fantastic, but once the movie starts, I want to use my iPad for other things!!!  Can this be put on the "to do" list for devs?

    the guy behind you wrote:
    From what I can tell, when I select the movie and hit the airplay button to move it to the apple TV, my iPad is still doing all the work of streaming the movie.  Why can't the apple TV take over the heavy work at this point?  I'd like to be able to use my iPad as more of a remote with an awesome interface for the apple TV.  The netflix app on iPad is great, and the easiest way to browse movies, and pushing them to the apple TV is fantastic, but once the movie starts, I want to use my iPad for other things!!!  Can this be put on the "to do" list for devs?
    Have you tried the Remote app on iPhone/iPad to control AppleTV, do searches etc?  Should be easier than the remote alone and this does not involve Airplay.
    Please note, only users read/comment here  - your idea is quite sensible in my view (maybe have a 'Continue viewing on AppleTV' option or something.  I doubt this would be high on Apple's roadmap but send them feedback here:
    http://www.apple.com/feedback/appletv.html

Maybe you are looking for