Measure SUM vs. SUM(measure)

Problem solved, it was another reason!
Hello,
I have a problem I don't understand. What is the different between using "measure SUM" and "SUM(measure)"? If I use it alone it will both give me correct results, if I use it in another formula the results are different:
sum(m1) = 2
sum(m2) = 1
sum(m1) - sum(m2) = 0 <-- that's wrong
m1 SUM = 2
m2 SUM = 1
m1 SUM - m2 SUM = 1 <-- that's correct, but what is different?
Thank you
Tobias
Message was edited by:
toki

It was a strange kind of problem and unfortunately i cannot regenerate it well.
First there was a calcalation (sum(m1) - sum(m2)) which was accumulated. The sum did not return exaclty the correct value. Then, i tried several formulas, sums, drills I cannot remember all combinations and changed the formula to m1 SUM - m2 SUM and it worked fine. Then, after my posting here I rubbed my eyes as I saw that m1 SUM - m2 SUM now did also returned the wrong result.
I cannot explain this behavior, however, the lost values were caused by NULL-values in some rows (e.g. 5 - NULL = NULL, it should by 5 - 0 = 5), so I added a CASE WHEN m2 IS NULL THEN 0 ELSE m2 END.
Tobias

Similar Messages

  • Mdx : Sum up the measure from start but need only non empty rows

    Hi All
    i have created a calculated measure where it suming up all its previous avaialable values based on Date dimension.
    Everything is working but we are getting all rows from that datetimension . how can get only till current date,
    SUM(NULL:[Date].[Hierarchy].currentmember,[Measures].[SIMID])
    Surendra Thota

    Hi Surendra,
    According to your description, you want to calculate the sum up the measure from start for those non empty rows, right?
    In this case, please try the query below.
    WITH MEMBER [Measures].[Sum from start]
    AS
    SUM ({NULL:[Date].[Calendar].CurrentMember},
    [Measures].[Internet Sales Amount])
    SELECT {[Measures].[Internet Sales Amount],[Measures].[Sum from start]} ON 0 ,
    nonempty([Date].[Calendar].[Calendar Year].MEMBERS) ON 1
    FROM [Adventure Works]
    Result
    Besides, here is a blog which describe various way to calculate running total, please see:
    http://blog.sqltechie.com/2011/01/various-way-to-calculate-running-total.html
    Regards,
    Charlie Liao
    If you have any feedback on our support, please click
    here.
    Charlie Liao
    TechNet Community Support

  • Measure aggregate sum not summing

    Hi
    I have many universes, and for all universes I have set measures to sum, where appropriate. However, this seems to work sometimes, and not others. I can't work out when or why it does or doesn't! Does anyone have experience of this?
    Thanks

    Hi Louise,
    Let me try to explain in a bit more detail...
    The a) aggregation is done by the group by clause in the actual select that is sent to the database,
    so it differs depending on what the user selects when building the query.
    But it will do this using the aggregation function you specified in the select.
    So if you have
    measure object sales sum(sales.amount)
    dimension objects country country.id and store store.id
    Then the select for a query containting the two objects sales and country would have a group by country.id
    The select for the query containing all three objects would have a group by on country.id,store.id
    You can verify the actual group by by looking at the generated SQL in the query builder.
    The b) aggregation is done according to what is specified in the advanced tab.
    You see this tab when you are in Designer and open the object properties dialogue.
    Its the second tab in it. (first is the select and where box, second it the aggregation (top part) and list of values (bottom part).
    So say you selected all three objects and then created a table with only country and sales, the sales figures (that were queried per store, per country) will be aggregated according to that 2nd tab to the country level.
    Note that when you use an aggregation function in the select, Designer will make a best quess as to the aggregation wanted and pre-fill it. So for the sum() function, it will also use sum as aggregation in 2nd tab.
    Hope this helps
    P.S. looking at the actual generated SQL will also help you determine if you have more that one select done to fullfill you dataprovider. If you have more than one, it is only acceptable if the differences are in measures only. If not, you will get more than one cube back from your query, without any control over how they are synchronized. If so you can try multicube to get the results you would expect (i.e. seen as one big cube i.s.o. more than one).

  • I want to show sum of two measures in Crosstab, is it possible?

    Hello,
    I want to show sum of two measures in Crosstab. There are only two measures in BW query, and I want to show sum of them by new column in Crosstab component.
    For example:
    Measure 1
    Measure 2
    Sum (New Column)
    100
    200
    300
    50
    30
    80
    30
    90
    80
    Is it possible ?
    Thanks.

    Hi,
    Design Studio is not capable to calculate that. If you like you can do it in BEx Query Designer as mentioned above.
    Alternatively you can open your Query in Analysis Office and do the calculation there. Then you can smart copy and paste the navigation state into Design Studio.
    Dirk

  • Distinct count inside a measure group with other measures

    Hello,
    I have 1 distinct count inside a measure group with other measures, sum, count etc. I know this is not recommended due to poor processing performance and query response time.
    Processing performance I can live with if it means not having another measure group, which increases processing time anyway.
    I have used the recommended approach before and it generated many questions about what this second measure group is for (visible via excel), even though I made the distinct count appear in the main measure group via a calculated measure.
    (it would be nice if you could hide measure groups)
    However my question is: is query response time only effected when the distinct count is used in the query? Or is query response time effected regardless if the distinct count is used or not??
    Below is an extract from the 2005 distinct count optimizer white paper. It’s not completely clear but I assume if effects queries regardless if distinct count is used or not?
    "By adding other measures to the measure group holding a distinct count measure, all of the other measures will be at the same granularity as the distinct count measure, resulting in inefficient data structures and suboptimal
    queries."

    You might also be interested in reading this blog post, which deals with a similar scenario, to get a feeling for some of the things that might be going on behind the scenes:
    http://cwebbbi.wordpress.com/2012/11/27/storage-engine-caching-measures-and-measure-groups/
    Chris
    Check out my MS BI blog I also do
    SSAS, PowerPivot, MDX and DAX consultancy
    and run public SQL Server and BI training courses in the UK

  • Is there a way to automatically build measure object with SUM(col_name) from INT DB column?

    Hello,
    I have a workflow that needs to be repeated every month and I'd like to optimize it.
    1. DB table in SQL Server 2008 looks something like this:
    TABLE [CONTRACTS_GCO_LVL2](
      [CONTRACTS_BP_ID] [varchar](50),
      [Flag 1] [int] ,
      [Flag 2] [int] ,
      [Flag 3] [int] ,
    2. I bring this table into my BOE IDT 4.0.3 and drag it into object folder. All INT columns become dimensions. This is not what I want. These are 1/0 flags for me and I need them to be measures with SUM aggregation.
    3. I select all these INT sourced dimensios and right click on them with "Turn into measure with aggregation function - SUM"
    The problem is that step #3 is unbelievably slow. I need to spend hours doing this as I have thousands of these flags. I end up selecting all dimensions from one screen and converting them at the same time. This takes 4-5 minutes. IDT runs on a Win 2008 R2 Enterprise server with 32 GB RAM and 4 CPUs.
    In Universe Designer there used to be external strategies that allowed some customization of how the objects get automatically created from DB tables. I know there are no strategies in r4 (External strategy for tables)  but is there anything else to make this process faster?
    Thank you all!
    Natasa

    Hrm, I'm suspecting that perhaps it has to do something with setting CHAR fields. Some of the fields in this table are CHAR but I don't see a call in my PreparedStatement that can set a char, only a String, so that's what I've been using, but it may be that that's not the right thing to do. I'm running Java 1.5.10, and looking through the API there doesn't seem to be anything specifically for char.

  • Reg: measuring point creation and measuring point counter creation

    how to create measuring point and measuring point counter.
    what is the difference between these two.
    what is measuring point category,
    what is measuring point
    what is measuring point object
    what is measuring position.
    can anyone explain me in an easy for better understanding.

    Firstly a Measuring point is nothing but, a factor which you measure on an equipment/FL. (Temperature, Vibration etc)
    Then, a measuring point is created either on a Functional location or on an Equipment.
    IK01 is the T-code for creating it.
    If it is for F/L you have to use IFL as measuring point object, when it is an equipment you use IEQ
    Generally these two will be in use.
    In the IK01 screen if you tick the counter checkbox, the MP becomes a counter.
    Example for simple MP is temperature.
    And example for a Counter MP is 'Litres of petrol consumed'
    In the first case you don't need to add the temperature measurements, whereas in the petrol consumption you may wish to have the cumulative value of readings taken for a period of time.
    The measuring position: Example : If you are measuring the temperature of a Motor on the Drive side, you may put 'Drive End' in this field, or similar many applications.
    Category would group these MPs.
    In case of need you may define in customisation a sep[arate MP category.
    Then each time you read a MP through IK11 or other methods a Measuring Document is created.
    Regards
    Jogeswara Rao

  • HELP "Select SUM(x), SUM(y)" different between 8.1.6 and 8.1.7.2 ?

    The following query runs fine under 8.1.6 but returns bad result under 8.1.7.2 :
    SELECT SUM(NBANOMALIE4), SUM(NBANOMALIE2)
    FROM
    (SELECT COUNT(*) "NBANOMALIE2" FROM CPN A, ANOCPN B WHERE A.CODENS= '128' AND B.CODANO='2' AND A.NUMFOR = B.NUMFOR ) ,
    (SELECT COUNT(*) "NBANOMALIE4" FROM CPN A, ANOCPN B WHERE A.CODENS= '128' AND B.CODANO='4' AND A.NUMFOR = B.NUMFOR )
    GROUP BY NBANOMALIE2, NBANOMALIE4;
    Result given under 8.1.6 is
    SUM(NBANOMALIE4) SUM(NBANOMALIE2)
    1 0 (correct)
    Result given under 8.1.7.2 is
    0 0 (wrong)
    if query is changed to "SELECT SUM(NBANOMALIE2), SUM(NBANOMALIE4) ..."
    Result given under 8.1.7.2 is
    1 1 (wrong too !)
    actually the result given for ALL is the result of the last "SUM()" in the select ...
    Is it a bug ? if so any patch ? Is there a workaround ?
    Thanks for any help
    Charlie [email protected]

    a solution was to use decode()
    here is a workaround :
    SELECT DECODE(B.CODANO,'2',1,0) NBANOMALIE2, DECODE(B.CODANO,'4',1,0) NBANOMALIE4
    FROM CPN A, ANOCPN B
    WHERE A.CODENS= '128' AND B.CODANO IN ('2','4') AND A.NUMFOR = B.NUMFOR;
    I had it from http://www.orafaq.com/. ...
    Charlie [email protected]

  • Sum the sum of fields in crystal report

    In crystal report 2008, i have rows of data grouped by document number. Sum of each document (RTotal1) display at Group Footer.
    At the Report Footer level, I want to display the Grand Total. In formula workshop, I tried to add a formula to sum RTotal1 above. However, error message indicated 'this field cannot be summarized'.
    Second try: In Running Total Fields, I tried to add RTotal1 above to the field but error message indicated 'invalid field selection'. Any idea what's the proper way to sum the sum of fields?

    You need to use a variable, create 3 formula
    @reset
    whileprintingrecords;
    global numbervar GTotal:=0;
    //place this in report header, or higher grou header as appropriate
    @Eval
    whileprintingrecords;
    global numbervar GTotal:=GTotal + Sum( valuefield, groupfield);
    // place this in group footer where your sum shows
    @display
    whileprintingrecords;
    global numbervar GTotal;
    //Place this in report or higher group footer
    Ian

  • Convert measure dimension to flat measure option not found

    Hi All,
    I am integrating Essbasse with BI. In the physical layer, I tried to convert measure dimension to flat measures. But when I right clicked my Essbase cube I am unable to find the
    convert measure dimension to flat measures option . My BI machine version is 11.1.1.6 .Kindly guide me to overcome this issue.
    Thanks and Regards
    Sai

    Sai, you first have to make sure that the properties of ONE of your dimensions is set to be a measures dimension. Then this option will show up upon right clicking.

  • Supplement Units of Measurement and Units of Measure

    Hi All,
    The company i work for, the WM system fabrics are stored in the Roll based form and in the QM module i have to create inspection lot for it. I found in the customizing "Supplement Units of Measurement and Units of Measure" which i think will help me in my process. Please explain the procedure for the "Supplement Units of Measurement and Units of Measure" in customizing.
    Regards,
    DTD

    http://help.sap.com/erp2005_ehp_04/helpdata/EN/c6/f83bb94afa11d182b90000e829fbfe/frameset.htm

  • Cumulative SUM based on Measure FROM LOWER to HIGHER

    Hello,
    I tried to find some post like mine but i did not find it.
    I have this scenario:
    Filter
    Cod Store
    Value
    Cenario 1
    City: RJ
    1112
    574924.05
    Type: Infantil
    1449
    617860.04
    Store: Carrefour
    1023
    873678.53
    But i need to create a new calculated member based on VALUE from LOWER to HIGH making a cumulative sum like this:
    Filter
    Cod Store
    Value
    What i NEED
    Cenario 1
    City: RJ
    1112
    574924.05
    574924.05
    Type: Infantil
    1449
    617860.04
    1192784.09
    Store: Carrefour
    1023
    873678.53
    2066462.62
    Here it is ordered by VALUE already, but in my cube is may not be. Can someone help me? i trying many ways but no one works fine.
    <b>Fabrizzio A. Caputo</b><br/> Certificações:<br/> MCT<br/> MCC<br/> Oracle OCA 11g<br/> MCITP SQL Server 2008 BI<br/> MCITP SQL Server 2008 Implementation and Maintenance<br/> MCITP SQL Server
    2008 Developer<br/> ITIL V3 Foundation <br/> Blog Pessoal: <a href="http://fabrizziocaputo.wordpress.com">www.fabrizziocaputo.wordpress.com</a><br/> Email: [email protected]

    Hi Fabrizzio,
    Most of the running total snippets you will find in the forums contains elements like currentmember, prevmember or ranges [A : B] that also refers to members.  Unfortunately the relative position of those elements  are extracted from the hierarchy
    level  of the correspondent members as defined in the cube dimensions and not from the ordered (query scope) set.
    The usual solution is to define a measure as the rank in the ordered set and take  the cumulative sum with head ():   sum(  head( ordered set, till the rank) , by the value measure ).
    If you choose the recursive solution for the running total you could use item() in combination with rank: maybe something like orderedset.item(rank measure) as an ersatz of currentmember.
    Philip,

  • Sum(misses)/(sum(gets)

    Hi,
    is it any way to combine all these :
    select name, gets, misses,
    immediate_gets, immediate_misses, sleeps
    from v$latch
    where name in ('redo allocation', 'redo copy')
    set head off
    select 'Ratio of MISSES to GETS: '||
    round((sum(misses)/(sum(gets)+0.00000000001) * 100),2)||'%'
    from v$latch
    where name in ('redo allocation', 'redo copy')
    select 'Ratio of IMMEDIATE_MISSES to IMMEDIATE_GETS: '||
    round((sum(immediate_misses)/
    (sum(immediate_misses+immediate_gets)+0.00000000001) * 100),2)||'%'
    from v$latch
    where name in ('redo allocation', 'redo copy')
    Many thanks.

    I tried this
    SELECT name, gets, misses,
    immediate_gets, immediate_misses, sleeps, 'Ratio of MISSES to GETS: '||
    round((sum(misses)/(sum(gets)+0.00000000001) * 100),2)||'%', 'Ratio of IMMEDIATE_MISSES to IMMEDIATE_GETS: '||
    round((sum(immediate_misses)/
    (sum(immediate_misses+immediate_gets)+0.00000000001) * 100),2)||'%'
    FROM v$latch
    WHERE name IN ('redo allocation', 'redo copy')
    GROUP BY name, gets, misses,immediate_gets, immediate_misses, sleeps
    but I have
    query column #7 ('RATIOOFMISSESTOGETS:'||ROUND((SUM(MISSES)/(SUM(GETS)+0.00000000001)*100),2)||'%') is invalid, use column alias
    Please help.

  • How to Recursively Sum a Sum?

    Sorry, everyone, this is driving me nuts.  I have the following query, which gives me the relative percentage of [INDEX MARKET CAP].
    SELECT *, [INDEX MARKET CAP] * 100/SUM([INDEX MARKET CAP]) OVER() as [%]
    FROM [S&P_Emerging_SmallCap_(US_Dollar)]
    So, I get a sum of the [INDEX MARKET CAP], and then find the relative percentage of each items in the INDEX MARKET CAP.  Great!  now, I'm trying to modify the query a bit to give me the SUM of each relative INDEX MARKET CAP.  So, the sum will
    be 100%!  I just want to prove that the query works.
    I'm trying to follow the example here.
    http://technet.microsoft.com/en-us/library/ms190766%28v=sql.105%29.aspx
    It seems so simple, but this dang thing just won't work.
    I think it should be something like this.
    ;With CTE (Company, [%])
    AS
    SELECT *, [INDEX MARKET CAP] * 100/SUM([INDEX MARKET CAP]) OVER() as [%]
    FROM [S&P_Emerging_SmallCap_(US_Dollar)]
    Select Company, SUM([%]) as Total
    FROM CTE
    Group By Company, Total
    I keep getting this.
    Msg 156, Level 15, State 1, Line 3
    Incorrect syntax near the keyword 'SELECT'.
    Knowledge is the only thing that I can give you, and still retain, and we are both better off for it.

    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. The garbage you
    posted has spaces in it! That means that you cannot use those names in any ISO standard programming. You are an 1950's COBOL Programmer who does not understand tiered architectures, so he writes headers for display instead of having a presentation layer. In
    fact, you are even worse with all that meta-data garbage in your data elements. USD is a unit of measurement on a scale, not part of a data element name. Is there any way you can get a book or course in basic data modeling?? 
    Why do you think that “company” is a clear, precise data element name that is an industry standard? It is not! This generic, vague and useless. I would guess that you are using a ticker symbol or a DUNS as the identifier. But it might be “company_<anything>”
    or worse. What is that generic “total”? Why did you destroy any hope of a data dictionary with crap like [%]?? First of all, we use double quotes in ANSI/ISO Standard SQL, so this disaster should have been “%” without the brackets. Why do you think you can
    use that  one character name anywhere else? What language? The best it could be is "generic_percentage", so that programmers that follow you will know it is crap. Pros write code for the maintenance guys that have not been hired yet, not for personal
    spreadsheet use. 
    50 years ago when you were writing COBOL, there was a hierarchical record structure. In RDBMS, rows are not records and columns are not fields. The fields (attributes) are drawn from domains of scalar values. The names exist in those domains. Your automobile
    is a VIN everywhere in the universe! It is not local. 
    Temporal data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect. 
    This is minimal polite behavior on SQL forums. 
    >> Sorry, everyone, this is driving me nuts. I have the following query, which gives me the relative percentage of [INDEX MARKET CAP].
    SELECT *, [INDEX MARKET CAP] * 100/SUM([INDEX MARKET CAP]) OVER() AS "generic_percentage" FROM [S&P_Emerging_SmallCap_(US_Dollar)] <<
    >> So, I get a sum of the [INDEX MARKET CAP], and then find the relative percentage of each items in the INDEX MARKET CAP.  Great!  now, I'm trying to modify the query a bit to give me the SUM of each relative INDEX MARKET CAP. So, the sum will
    be 100%! <<
    No, it will not. In fact, you will be lucky to get 99.99% -- do you understand rounding errors? Since you were rude (really, really rude by SQL Forum standard, in fact)  We have no idea what data types we have here; we have to guess you used DECIMAL(s,p)
    so you might get better answers with “index_market_cap * 100.0000 /SUM(index_ market_cap) OVER() AS index_market_cap_percentage”; See the decimal places? Unlike spreadsheet, we have to worry about this in SQL. 
    As far as your error goes, look at the CTE column list and the GROUP BY; they do not match ! 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Sum the Sum total values above

    Post Author: John Patterson
    CA Forum: Formula
    I have created a report that contains a list of values (in a group) that come from a formlar that has Sum {} totals in it.  All I want to do is sum that list into one value below, just like Excel would do!
    Crystal won't allow me to sum the results of group sum totals higher up the report.   I have been told that I need to create a conditional running total or a set a variable to store the values required.
    Any ideas?
    Many thanks
    John

    Post Author: fusion
    CA Forum: Formula
    Definitely Jami,I found out that Running Total is an answer. I still  need to find out how to get a percentage of the total using a running total. When you use a summary option then there is a option that allows you to have the filed as a % of the total of that filed. How can you do the same using running total. I am trying to work with formulas but no any luck so far.Your help is highly appreciated

  • Question about Measure folders Items (dimensions & measures)

    Hi All,
    I have tow question about measure folder
    1-     How can I make measure folder contain both dimensions & measures?
         Like this image http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/bi/r10122/images/d1t10202.gif
    2-     When I create measure folder and add some measures in it, when I query cube these measures still displayed out of folders how can I make all measures and dimensions displayed only on folders like the above image ?
    Regards,
    Gado

    Hi Andy,
    There should be no difference in functionality for these two kinds of folders. You can perform all the operations on these two kinds of folders without any difference, for example, delivery messages, create view settings/rules and etc.
    Regards,
    Ethan Hua
    TechNet Community Support
    It's recommended to download and install
    Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
    programs.

Maybe you are looking for