YTD AVG with Nulls Measure

I have the following MDX for a YTDAVG custom measure.  The problem is that it ignores NULLS in the DB.  For Example if I'm in the 3rd period and my montly amounts for an account are 25,0,&75, the measure returns 50.  I want the measure to return 33.3 (25075)/3.  How can I adjust the MDX below to get the correct YTDAVG calculation.
'IIF([ACCOUNT].CURRENTMEMBER.PROPERTIES("ACCTYPE")="INC",AVG(YTD(),-MEASURES.[SIGNEDDATA]),IIF([ACCOUNT].CURRENTMEMBER.PROPERTIES("ACCTYPE")="EXP",AVG(YTD(),MEASURES.[SIGNEDDATA]),IIF([ACCOUNT].CURRENTMEMBER.PROPERTIES("ACCTYPE")="AST",(MEASURES.[SIGNEDDATA], CLOSINGPERIOD([TIME].[MONTH])),IIF([ACCOUNT].CURRENTMEMBER.PROPERTIES("ACCTYPE")="LEQ",-(MEASURES.[SIGNEDDATA], CLOSINGPERIOD([TIME].[MONTH])),-MEASURES.[SIGNEDDATA]))))'

Worked on it finally got the solution:-
I am working on SAP BPC 10 and here is the code for YAVG with Null measures
1) Null measures :- is taken care by the code line :- COALESCEEMPTY([MEASURES].[/CPMB/SDATA],0)
2) YEAR property of TIME dimension is not accepted instead of that I took LEVEL00 in my PERIODSTODATE function
PERIODSTODATE([%TIME%].[LEVEL00],[%TIME%].CURRENTMEMBER)
LEVEL00 - YEAR
LEVEL01 - QUARTER
LEVEL01 - MONTH
3) MONTHNUM is the property I maintained in my Time dimension and its datatype is "CHAR" so we need to convert it to interger.
Usually in older version the strtovalue is user to achieve point 3 but in NW it is not accepted so I used the following function
IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="1",1,IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="2",2,0))
add 10 more lines for all the months as shown below:-
  MEMBER [MEASURES].[YAVG] AS 'IIF([%CFP_ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC" OR [%CFP_ACCOUNT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="EXP",SUM(PERIODSTODATE([%TIME%].[LEVEL00],[%TIME%].CURRENTMEMBER),COALESCEEMPTY([MEASURES].[/CPMB/SDATA],0))/
IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="1",1,IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="2",2,IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="3",3,IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="4",4,IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="5",5,IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="6",6,IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="7",7,IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="8",8,IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="9",9,IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="10",10,IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="11",11,IIF([%TIME%].CurrentMember.Properties("MONTHNUM")="12",12,0)))))))))))),[MEASURES].[/CPMB/SDATA])'

Similar Messages

  • OBIEE Date Comparison report with multiple measures

    Hello everyone...
    I have a requirement where I need to create a date comparison report (Current Month vs. Prior Month vs Prior Month Year Ago vs YTD vs Prior YTD vs Rolling 3 months, etc) with multiple Measures (Quote count, Quote offered count, New Business count, etc). I am to generate this report in this fashion:
    Quotes Current Month vs PM vs YoY Prior
    Month Current Month Prior Year Current
    YTD vs PM Prior
    YTD Rolling 3 Months vs PM Prior Rolling 3 Months
    Issued 120 120 123 1400 1020 1700 1580
    Unique Risks
    Offered 556 449 571 5881 6220 6101 5892
    Unique Risk Close Ratio
    Offered Close Ratio 21.6% 26.7% 21.5% 23.8% 16.4% 27.9% 26.8%
    Bitmap
    Avg Issued Premium 240 238 222 2801 2630 3104 2892
    Avg Offered Premium
    New Business
    Count
    Avg Full Term Premium
    I understand that time series is an option, and have created the time series (which show up as measures).
    My problem is:
    when creating the report (even as a pivot table) , OBIEE is not allowing me to drag the measure to rows, nor is it allowing me to drag the time series to columns. Also, I need to do conditional formating on some of the columns showing an up arrow for increased vs. prior month and down arrow for decreased vs. prior month.
    Does anyone have a solution for this issue? Any assistance would be greatly appreciated...
    Please advise and thanks!!!

    Jason,
        You've been very helpful, but I guess I'm just not explaining myself that well. The Credit Memo's throw things off because they do not contain a "Paid Date" value. That field in the record is blank. Since it is blank the report query ignores them. Therefore when the report query returns all records that have a "Paid date" range of "x to y" they are never returned. This is a problem whenever a credit memo exists for an invoice because the "invoice total" never changes. So when a customer pays on their account for a particular invoice, they only pay what is due which is the "invoice total" minus any "credit" from the "Credit Memo". So when my A/R person receives payment they are showing the invoice paid in full because MAS automatically includes all invoices and credit memo's. My report does not because there is no data in the "Paid Date" field of the record for Credit Memos.
    I've been doing alot research in trying to resolve this "exception" to my report. I think I may be on to something, but my knowledge of arrays is extremely limited. My resolution involves populating an array with the "invoice numbers" that are returned from the initial query from the supplied date range. Then using the "invoice numbers" from the array have it then populate my details section of the report with all of "invoice records" both the actual invoice record and any "credit memo" records. I can then group the records returned  based upon the "invoice number". then within that grouping I can performing my calculations to show whether or not the invoice has been paid in full. What do you think?  I've been able to populate an array with the invoice numbers based upon my date search range, but I have yet to figure out how to take that information and perform another lookup to pull in the rest of the data I need. Do you have any ideas?
    Thanks.  Bill

  • Problem with calculating measures in AWM

    Hi,
    We created dimensions and cubes in AWM (or in OWB) - without using materialized views. We we maintain cube using sum, min and max aggregation function eberythink is OK - we can see data in views, but when we maintain cube using other function e.g. average we see, that in view we have aggregated data using sum function, so:
    sum makes sum
    min makes min
    max makes max
    other functions makes sum
    Oracle DB 11gR2 for win 64-bit
    awm latest version 11.02 patchA
    what to do? maybe we don't understand something?

    One more time:
    Hello,
    I checked it. Unfortunately You're wrigth. I have simple CUBE AW_T5_V2 with three measures:
    cena,
    przebieg,
    rok
    and two simple dimensions:
    aw_kolor with levels
    KOLOR and
    ODCIEN (ODCIEN_ID is foreign key)
    aw_model with levels
    MARKA
    MODEL
    SILNIK (SILNIK_ID is foreign key)
    In point 1. and 2. everything is OK. (I mean in cube definition in dba_cubes:
    SOLVE
    AVG
    ALLOW OVERFLOW
    ALLOW DIVISION BY ZERO
    IGNORE NULLS OVER CPOWBADMHD.AW_KOLOR,
    AVG
    ALLOW OVERFLOW
    ALLOW DIVISION BY ZERO
    IGNORE NULLS OVER CPOWBADMHD.AW_MODEL
    and in AGG_MAP definition in OLAP Worksheet
    DEFINE AW_T5_V2_SOLVE_AGGMAP AGGMAP LOCKDFN
    AGGMAP
    RELATION this_aw!AW_KOLOR_AGGRREL(this_aw!AW_T5_V2_SOLVE_AW_KOLOR_HVSET) PRECOMPUTE(NA) OPERATOR AVERAGE args DIVIDEBYZERO YES DECIMALOVERFLOW YES NASKIP YES COUNT YES
    RELATION this_aw!AW_MODEL_AGGRREL(this_aw!AW_T5_V2_SOLVE_AW_MODEL_HVSET) PRECOMPUTE(NA) OPERATOR AVERAGE args DIVIDEBYZERO YES DECIMALOVERFLOW YES NASKIP YES COUNT YES
    AGGINDEX NO
    CACHE SESSION
    END
    But in cube_build_log I can see script in OUTPUT column:
    <SQL>
    <![CDATA[
    SELECT /*+ bypass_recursive_check cursor_sharing_exact no_expand no_rewrite */
    T14_ODCIEN_ID ALIAS_51,
    T11_SILNIK_ID ALIAS_52,
    SUM(T17_CENA) ALIAS_53,
    SUM(T17_PRZEBIEG) ALIAS_54,
    SUM(T17_ROKPROD) ALIAS_55
    FROM
    SELECT /*+ no_rewrite */
    T1."PRZEBIEG" T17_PRZEBIEG,
    T1."CENA" T17_CENA,
    T1."ROKPROD" T17_ROKPROD,
    T1."AW_KOLOR" T17_AW_KOLOR,
    T1."AW_MODEL" T17_AW_MODEL
    FROM
    CPOWBADMHD."AW_T5_TAB" T1 )
    T17,
    SELECT /*+ no_rewrite */
    T1."DIMENSION_KEY" T14_DIMENSION_KEY,
    T1."ODCIEN_ID" T14_ODCIEN_ID
    FROM
    CPOWBADMHD."AW_KOLOR_TAB" T1 )
    T14,
    SELECT /*+ no_rewrite */
    T1."DIMENSION_KEY" T11_DIMENSION_KEY,
    T1."SILNIK_ID" T11_SILNIK_ID
    FROM
    CPOWBADMHD."AW_MODEL_TAB" T1 )
    T11
    WHERE
    ((T14_DIMENSION_KEY = T17_AW_KOLOR)
    AND (T11_DIMENSION_KEY = T17_AW_MODEL) )
    GROUP BY
    (T11_SILNIK_ID, T14_ODCIEN_ID)
    ORDER BY
    T11_SILNIK_ID ASC NULLS LAST ,
    T14_ODCIEN_ID ASC NULLS LAST ]]>/>
    </SQL>
    It should be AVG, where is SUM (I've checked that, when I update agg method to min or max function is changing from sum to mix or max). I suppose SQL should sum measures and devide by number of records.
    OK, we know where is bug, what to do?

  • Import data with nulls in Desktop Intelligence

    Hello,
    I have data with null values (in a measure).  If I export the data as CSV it shows null values as #EMPTY.  If I use that as a datasource, it loads #EMPTY as 0 (zero).
    Is there a way to make desktop intelligence recognize null values?  I tried to remove the #empty and just leave the column empty, it still loads as a numeric zero.
    Same (actually worse) for XML.  It seems if I export my data to XML it can not use that as a datasource.  Odd.  So I created the following XML file:
    <?xml version='1.0' encoding='UTF-8'?>
    <data>
      <item key="AAAAAEUK" value="130" category="A" />
      <item key="AAAACGDC" value="66" category="A" />
      <item key="AAAADNJP" value="56" category="A" />
      <item key="AAAAFWRQ" value="222" category="A" />
      <item key="AAAAGITU" category="B" />
    </data>
    I would expect the value field to be null for the last row.  But the values turns out to be 222!  If I try to put anything else, an empty string "", "#EMPTY", "null", it is always returned as 0.
    This is a problem because 0 an null are differnt when computing averages.

    Hi Florian,
    What is the source of your csv data?
    If I have a table in excel with empty cells, the data goes into the .csv as nothing so your example would look like
    Item key,value,category
    AAAAAEUK,130,A
    AAAACGDC,66,A
    AAAADNJP,56,A
    AAAAFWRQ,222,A
    AAAAGITU,,B
    This reads in just fine in DeskI (shows #EMPTY in the view data, treats it as such in the report).
    So I would look to get the data generated in right way, then DeskI can handle it, no problem.
    If all else fails, just run a search&replace and change ,#EMPTY, to ,,
    BTW if you have an alphanumeric value in a column where DeskI already decided there should be numeric,
    it will read in as 0, that is why the #EMPTY string value got transformed to zero.
    Good luck,
    Marianne

  • Need help with NULL values in Crosstables

    Hello everybody,
    I need some help with NULL values and crosstables. My issue is the following:
    I have a query (BW - MDX-Query) that gives me turnover measures for each month. In Crystal Reports I choose crosstable to display this whereby I put all month in columns and all turnover-measures in rows. Each month that has a value (measures are not empty) is chown in the crosstables rows. So far so good. The problem occures when there are month that actually have no values (measures are empty). In that case these months are not chown in columns. But I need CR to display these columns and show the value 0. How can I do that?

    Hi Frank,
    Cross tab shows the data based on your column and these column fields are grouped and based on the group it will show your summaries. 
    If there is no data for any of your group it will not display that group.  In this case you will have to create a standard report which should look like cross tab and to get zero values you need to write formulas .
    Example if you want to display Moth wise sales :
    if Month() = 01 Then
    sum() else 0
    Now this formula will check if your month is Jan, then it will sum up the values else it will display zero value. 
    This is possible only through standard report not with Cross Tab.
    Thanks,
    Sastry

  • AVERAGE on crosstable with NULLs

    Hi,
    I try to set average function on column in crosstable. Data contains NULLs. I got error during displaing report in HTML format (in Interactive format it's ok) - "oracle.xdo.XDOException: java.lang.reflect.InvocationTargetException".
    Oracle support says Publisher is not working with NULLs in crosstable - but in Interactive View it's ok (almost - I see NaN instead of empty/NULL value).
    This simple query and some data:
    SELECT
    'Group' || ROUND((LEVEL+1)/4) "GROUP",
    'Row' || LEVEL "ROW",
    TRUNC(CURRENT_DATE) "DATE",
    LEVEL VALUE1,
    CASE WHEN mod(LEVEL,2) = 0 THEN LEVEL+LEVEL ELSE CAST(NULL AS NUMBER) END VALUE2
    FROM DUAL CONNECT BY LEVEL <= 9;
    GROUP | ROW | DATE | VALUE1 | VALUE2
    Group1 | Row1 | 2011-08-02 | 1 |
    Group1 | Row2 | 2011-08-02 | 2 | 4
    Group1 | Row3 | 2011-08-02 | 3 |
    Group1 | Row4 | 2011-08-02 | 4 | 8
    In pure SQL i get correct result:
    SELECT "GROUP",
    AVG(VALUE1),
    AVG(VALUE2)
    FROM (
              SELECT 'Group' || ROUND((LEVEL+1)/4) "GROUP",
                   'Row' || LEVEL "ROW",
                   TRUNC(CURRENT_DATE) "DATE",
                   LEVEL VALUE1,
                   CASE WHEN mod(LEVEL,2) = 0 THEN LEVEL+LEVEL ELSE CAST(NULL AS NUMBER) END VALUE2
              FROM DUAL CONNECT BY LEVEL <= 9
    GROUP BY "GROUP"
    Edited by: stashek on 2011-08-08 23:37

    A step is a dimension, which represents date.
    User is prompted to choose possible period from such:
    25 months with step of 6 months
    13 months with step of 1 month
    1 day with step of 1 hour
    I have a special view in DB, which calculates each step, e.g. for period "1 month with step 1 day":
    Name              StartDate           EndDate                 Step                    Number
    1 month         2014-06-11         2014-07-11          2014-06-12            IM1000000
    1 month         2014-06-11         2014-07-11          2014-06-13            IM1000001
    1 month         2014-06-11         2014-07-11          2014-06-13            IM1000002
    So what I am doing, is calculating Count of Number ForEach step.
    Then I add field Resolution Code from another table, and thus I get my chart.
    Basically, what I need to have as trend line is Average Count for Each Step despite Resolution Code.
    Hope, this makes my issue clearer.
    P.S. =Average(Count(Number) foreach([Step])) in Report isn't helping, the issue is the same.

  • BottomCount with LastPeriod dealing with NULLs help needed

    I am trying to get the bottom 5 firms for the current period and then comparing it to the previous period.
    I am having difficulty removing the nulls from the current period without excluding the previous period altogether.
    The query is
    with
    MEMBER [Measures].[Name] AS
    ( Axis ( 1 ).Item ( 0 ).Item ( 0 ) .Hierarchy .CurrentMember.Name )
    SELECT
    [Measures].[Amount] ,
    [Measures].[Name]
    } ON COLUMNS,
    BottomCount (
    Filter (
    Except ( [Dim IFA Details].[Parent Key].[Adviser Group].Members, [Dim IFA Details].[Parent Key].[Adviser Group].Unknown)
    , not isempty([Measures].[Amount]) )
    , 5
    , ( [Measures].[Amount], [Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14] , [Dim Income Range].[Hierarchy].[Range ID].&[2])
    ) * LastPeriods ( 2, [Dim Date].[Fiscal Year].[Fiscal Year].&[FY 13/14] ) ON ROWS
    FROM [Income and Emails Cube]
    where
    [Dim Income Range].[Hierarchy].[Range ID].&[2]
    The null filter checks for all periods, so I am still getting nulls for the specific period I am looking at. If I try and specify the period in the filter, then last 2 periods doesnt work and I only get the current year results.
    How can I get around this?
    Regards
    Jon

    This seems to work:
    WITH MEMBER [Measures].[Name] AS
      ( Axis ( 1 ).Item ( 0 ).Item ( 0 ) .Hierarchy .CurrentMember.Name )    
    SELECT
    {  [Measures].[Amount] ,  [Measures].[Name]  } ON 0,
    [Dim IFA Details].[Parent Key].[Adviser Group].Members *
    LastPeriods ( 2, [Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14] ) ON 1
    FROM (
      SELECT [Measures].[Amount] ON 0,
      ( BottomCount (
        Filter (
          Except ( [Dim IFA Details].[Parent Key].[Adviser Group].Members, [Dim IFA Details].[Parent Key].[Adviser Group].Unknown ),
          NOT IsEmpty ( [Measures].[Amount] )
        5,
        ( [Measures].[Amount] , [Dim Income Range].[Hierarchy].[Range ID].&[2])
      [Dim Date].[Fiscal].[Fiscal Year].Members
       ) ON 1
      FROM [Income and Emails Cube]
      WHERE ( [Dim Date].[Fiscal Year].[Fiscal Year].&[FY 13/14], [Dim Income Range].[Hierarchy].[Range ID].&[2] )
    Is this the best way to solve it?
    Jon

  • Calculating  YTD AVG and QTD AVG

    Hi All,
    I am trying to crate custom measure formula for calculating  YTD AVG and QTD AVG in BPC 7.0 NW any help

    For this formula I am using Sum divided by..
    MEMBER [MEASURES].[YTD] AS 'IIF([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="INC",SUM(PERIODSTODATE([%TIME%].[LEVEL00], [%TIME%].CURRENTMEMBER),-[MEASURES].[/CPMB/SDATA]),IIF([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="EXP",SUM(PERIODSTODATE([%TIME%].[LEVEL00], [%TIME%].CURRENTMEMBER),[MEASURES].[/CPMB/SDATA]),IIF([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="AST",([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[LEVEL02])),IIF([%P_ACCT%].CURRENTMEMBER.PROPERTIES("2/CPMB/ACCTYPE")="LEQ",-([MEASURES].[/CPMB/SDATA], CLOSINGPERIOD([%TIME%].[LEVEL02])),-[MEASURES].[/CPMB/SDATA]))))';SOLVE_ORDER=3
    can please help me..

  • JDBC MS Access--- cannot extract entry with null value with data type Meta

    I'm trying to extract a data entry with null value by using JDBC. The database is MS Access.
    The question is how to extract null entry with data type memo? The following code works when the label has data type Text, but it throws sqlException when the data type is memo.
    Any advice will be appreciated! thanks!
    Following are the table description and JDBC code:
    test table has the following attributes:
    Field name Data Type
    name Text
    label Memo
    table contents:
    name label
    me null
    you gates
    Code:
    String query = "SELECT name, label FROM test where name like 'me' ";
    ResultSet rs = stmt.executeQuery(query);
    while (rs.next())
    String name = rs.getString("name");
    rs.getString("val");
    String label = rs.getString("label");
    System.out.println("\t"+name+"\t"+label);
    catch (SQLException ex)
    System.out.println(ex.getSQLState());
    System.out.println(ex.getErrorCode());
    System.out.println("in sqlexception");
    output:
    C:\Temp\SEFormExtractor>java DBTest
    yet SELECT name, label FROM test
    null
    0
    in sqlexception

    The question is how to extract null entry with data type memo?Okay, what you need to do is this:
    if (rs.getString("val") == null)
      // do something
    }This way, when it's a null value, you can check it first, and then handle it how you want, rather than getting an exception.

  • Windows Server 2008 R2 - Restore Previous Versions - Restored File Filled with Nulls

    ISSUE:
    The Restore Previous versions feature on my file server stopped working some time in the recent past.  If I look at the Previous Version for a file or folder the items are listed and they show a valid file size.  However, when I restore a previous
    version of a file it is completely filled with nulls.  I have tried local restores on the server and remote restores.  The results are the same; I get a file that is the correct size but completely filled with nulls.  The Server is Windows 2008
    R2 64.  I have searched for any reports of similar issues to no avail.   I'm looking for any ideas on how to resolve the issue preferably while maintaning archived files.

    Hello,
    Can you help me with this too?
    My Shadow copy stop working!
    When my clients right click on Folders, they saw only date in the past.. and the new date not comming!
    When i went to file server
    ==> Computer Management==> Right click on "Share Folder" after that, i got nothing! Only "Gray" at the "Title bar" of computer management.
    Please see attached:
    What should i do? Please help me.
    Best regards
    VeasnaYim

  • How to create a dimension object in SAP BW Unv with Null value

    Hello,
    for query syncronisation task, I need a dimension object in my BW universe with NULL value. Does someone know, how to do it or if its possible?
    Regards,
    Thilo

    Hi Thilo,
    so the only common item is Material then - correct ?
    Query 1                                                                                Query 2
    Formulation (grouping of materials)                                                  (No counterpart)
    Material                                                                                Material
    dummy key figure (why?)                                                                Company Code
                                                                                    10 Keyfigure
    Is this something you regular have to do ? what about a MultiProvider ?
    did you try "merged dimensions" in the Web Intelligence Report ?
    Ingo

  • Sql query slowness due to rank and columns with null values:

        
    Sql query slowness due to rank and columns with null values:
    I have the following table in database with around 10 millions records:
    Declaration:
    create table PropertyOwners (
    [Key] int not null primary key,
    PropertyKey int not null,    
    BoughtDate DateTime,    
    OwnerKey int null,    
    GroupKey int null   
    go
    [Key] is primary key and combination of PropertyKey, BoughtDate, OwnerKey and GroupKey is unique.
    With the following index:
    CREATE NONCLUSTERED INDEX [IX_PropertyOwners] ON [dbo].[PropertyOwners]    
    [PropertyKey] ASC,   
    [BoughtDate] DESC,   
    [OwnerKey] DESC,   
    [GroupKey] DESC   
    go
    Description of the case:
    For single BoughtDate one property can belong to multiple owners or single group, for single record there can either be OwnerKey or GroupKey but not both so one of them will be null for each record. I am trying to retrieve the data from the table using
    following query for the OwnerKey. If there are same property rows for owners and group at the same time than the rows having OwnerKey with be preferred, that is why I am using "OwnerKey desc" in Rank function.
    declare @ownerKey int = 40000   
    select PropertyKey, BoughtDate, OwnerKey, GroupKey   
    from (    
    select PropertyKey, BoughtDate, OwnerKey, GroupKey,       
    RANK() over (partition by PropertyKey order by BoughtDate desc, OwnerKey desc, GroupKey desc) as [Rank]   
    from PropertyOwners   
    ) as result   
    where result.[Rank]=1 and result.[OwnerKey]=@ownerKey
    It is taking 2-3 seconds to get the records which is too slow, similar time it is taking as I try to get the records using the GroupKey. But when I tried to get the records for the PropertyKey with the same query, it is executing in 10 milliseconds.
    May be the slowness is due to as OwnerKey/GroupKey in the table  can be null and sql server in unable to index it. I have also tried to use the Indexed view to pre ranked them but I can't use it in my query as Rank function is not supported in indexed
    view.
    Please note this table is updated once a day and using Sql Server 2008 R2. Any help will be greatly appreciated.

    create table #result (PropertyKey int not null, BoughtDate datetime, OwnerKey int null, GroupKey int null, [Rank] int not null)Create index idx ON #result(OwnerKey ,rnk)
    insert into #result(PropertyKey, BoughtDate, OwnerKey, GroupKey, [Rank])
    select PropertyKey, BoughtDate, OwnerKey, GroupKey,
    RANK() over (partition by PropertyKey order by BoughtDate desc, OwnerKey desc, GroupKey desc) as [Rank]
    from PropertyOwners
    go
    declare @ownerKey int = 1
    select PropertyKey, BoughtDate, OwnerKey, GroupKey
    from #result as result
    where result.[Rank]=1
    and result.[OwnerKey]=@ownerKey
    go
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Asset with Investment Measure; Depreciation reversal

    Hi,
    An asset is created with investment measure(through settlement of WBS) in 11/2008. In the same month it was depreciated fully.
    Now the users want the depreciation to be reversed. The fiscal year 2008 is already closed.
    Is there any way, the asset is brought back to its original APC value and to reverse the depreciation entry?
    Since the asset is created with Investment measure, it needs to be done through settlement of WBS only.
    Appreciate your help
    thanks
    srinivasa vepa

    When you created the investment measure it created 3 transaction types like:
    II1
    JI1
    KI1
    It is possible to change them or create new ones, I can not test this in our system, perhaps you can.
    To do this use the transaction: SM30 and View Cluster TABW_ALL. (this is the same as transaction OA81 but on this way you can create/change transaction types)
    Copy an existing one to a Z version with the following values
    Transaction type grp 52
    Credit transaction
    Document type      AF
    Do not post to Afiliated  co
    Post net
    I used this option only as Credit transaction. (I dont know if 52 is working with credit)
    Test it first in your Sandbox/ development system

  • 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

  • The User-Agent "Java/1.5.0_06" is unknown;creating an agent with null agent

    Hello,
    We're currently on JDeveloper 10.1.3.4.0.4270. We just release a new version of our web app into production. This is an internal web application. application server is weblogic 10. The weblogic log is showing alot of these warning messages. I tried search on this forum and in google but unable to find any information. I really appreciate if anyone has any idea what could be causing these warning. Our users are constantly getting sent back to the login page to to user sessions lost.
    <Jun 8, 2010 12:39:20 AM EDT> <Info> <Common> <BEA-000628> <Created "5" resources for pool "venusDS", out of which "5" are available and "0" are unavailable.>
    Jun 8, 2010 12:39:20 AM oracle.adfinternal.view.faces.agent.AgentFactoryImpl _populateNullAgentImpl
    WARNING: The User-Agent "Java/1.5.0_06" is unknown; creating an agent with null agent attributes.
    Jun 8, 2010 12:39:20 AM oracle.adfinternal.view.faces.agent.AgentFactoryImpl _populateNullAgentImpl
    WARNING: The User-Agent "Java/1.5.0_06" is unknown; creating an agent with null agent attributes.
    Jun 8, 2010 12:39:21 AM oracle.adfinternal.view.faces.agent.AgentFactoryImpl _populateNullAgentImpl
    WARNING: The User-Agent "Java/1.5.0_06" is unknown; creating an agent with null agent attributes.
    Jun 8, 2010 12:39:21 AM oracle.adfinternal.view.faces.agent.AgentFactoryImpl _populateNullAgentImpl
    WARNING: The User-Agent "Java/1.5.0_06" is unknown; creating an agent with null agent attributes.
    Jun 8, 2010 12:42:21 AM oracle.adfinternal.view.faces.agent.AgentFactoryImpl _populateNullAgentImpl
    WARNING: The User-Agent "Java/1.5.0_06" is unknown; creating an agent with null agent attributes.
    Jun 8, 2010 12:42:21 AM oracle.adfinternal.view.faces.agent.AgentFactoryImpl _populateNullAgentImpl
    WARNING: The User-Agent "Java/1.5.0_06" is unknown; creating an agent with null agent attributes.
    Jun 8, 2010 12:42:21 AM oracle.adfinternal.view.faces.agent.AgentFactoryImpl _populateNullAgentImpl
    WARNING: The User-Agent "Java/1.5.0_06" is unknown; creating an agent with null agent attributes.
    1698656.832: [GC [PSYoungGen: 145280K->5811K(187264K)] 418915K->302441K(650112K), 0.1285455 secs]
    Jun 8, 2010 12:42:22 AM oracle.adfinternal.view.faces.agent.AgentFactoryImpl _populateNullAgentImpl
    WARNING: The User-Agent "Java/1.5.0_06" is unknown; creating an agent with null agent attributes.
    Thanks,
    Joe

    Hi,
    user agent is the browser users use. So what is the browser ?
    Frank

Maybe you are looking for

  • Iphone restore many times

    i was wondering is there a limit to how many times i can restore my iphone 4? i mean, does it refuse to restore after a certain amount of time? i just had to restore mine a few times the past couple of weeks and i was wondering if this can have any n

  • MPN Material Issue.

    Hi Friends,                                    I have created a material and assigned MPN profile in it. I have created 2 MPN materials according to the vendor. Now I have created PR and then 2 PO's according to the vendor. Now I have received the ma

  • HT1935 In sudden motion sensor terminal it will not let put in my password...can any one help me?

    While recording music was prompt... Disk is too slow or System Overload. (-10008) The Sudden Motion Sensor may have parked the hard drive head, or the disk performance is not sufficient to read or write all audio tracks, or the system was not able to

  • [OER 11.1.1.6.3] More Search Options feature

    Hi experts, IHAC who is trying to use More Search Options feature. It is able to mark the Filter by Categorizations check box that displays all the categorizations. The problem is that the customer is unable to mark any check box in order to select t

  • SPA 525G2 / SPA509G German Character missing ä,ö,ü

    Hello Cummunity. Our SPA 509G and SPA 525G2 doens't display the german character ä, ö and ü. The Personal Addressbook looks like this: "PersĶönliche Kurzwahl" insted of "Persönliche Kurzwahl". Installation was done with CCA. How do i fix that ? Than