DAX Calculation shows incorrect results when driven from Time Slicer

Hi,
We have defined a DAX quarter on quarter calculation  
PREV Q % 13F:=divide([PREV Q ABS 13F],[Prior Quarter 13F])
Prior Quarter 13F:=CALCULATE(sum([TotalValue]), DATEADD(Time[Date], -1, QUARTER))
PREV Q ABS 13f:=CALCULATE(sum([TotalValue]))-[Prior Quarter 13F]
which works fine in Pivottables in Excel but when time selection is driven by a time slicer the calculation doesn't work anymore:
Is this a but or expected behaviour? Are there other ways to use a control that affects multiple other pivot tables like the time slicer?
Thanks for your help!
Martin

OK, there are some really interesting points here - i think the screenshot below best explains it:
Time Slicers use MDX subselects to propagate the selection to the pivot table:
SELECT .... FROM (SELECT Filter([Fact13FSample].[ReportDate].Levels(1).AllMembers, ([Fact13FSample].[ReportDate].CurrentMember.MemberValue>=CDate("2013-04-01") AND [Fact13FSample].[ReportDate].CurrentMember.MemberValue<CDate("2013-07-01")))
ON COLUMNS  FROM  ...
this works just fine for normal measures but seems to cause issues with time-intelligence function
it actually causes an issue with all calculations that use CALCULATE and thereby shift the context out of the subselect
it seems that you cannot get out of this context using DAX- at least i could not find a solution yet
not even this works:
All Quarter 13F:=CALCULATE([SumTV], ALL('Time'))
the result is always limited to the subselect :/
funny thing is that this only seems to happen with this specific subselects so i guess it is further related to MDX FILTER() or .MemberValue or CDATE()
the only option i could currently think of is to use regular slicers
Gerhard Brueckl
blogging @ http://blog.gbrueckl.at
working @ http://www.pmOne.com

Similar Messages

  • Oracle Discoverer report pulls incorrect result when scheduled.

    Recently the database was migrated to 10.1.2 RAC from 9.2.0.6, so the discoverer EUL is now resides on new database.
    after migration the report which pulls correct results when run interactively is pulling incorrect result when scheduled in Discoverer.
    This report used sysdate and aggregate functions, i had ran the same report simultaneously( Directly in Discoverer Desktop/Plus and scheduled in discoverer), but the data retrieved in both case is not matching.
    here is the query. any help is appreciated.
    SELECT /*+ FIRST_ROWS */ A.SITE_ID as E175108,B."SYSTEM DESCRIPTION" as System_Prefix,
    B."SYSTEM PREFIX" as System_Description,
    COUNT(CASE WHEN ( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ) < 0 THEN 1 ELSE TO_NUMBER(NULL) END) as Less_than_0_Days,
    COUNT(CASE WHEN ( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ) > 121 THEN 1 ELSE TO_NUMBER(NULL) END) as 0_to_14 Days,
    COUNT(DECODE(TRUNC(( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) )/31),3,( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ),to_number(NULL))) as 14_to_30_Days,
    COUNT(DECODE(TRUNC(( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) )/31),2,( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ),to_number(NULL))) as 31_to_60_Days,
    COUNT(DECODE(TRUNC(( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) )/31),1,( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ),to_number(NULL))) as 61_to_90_Days,
    COUNT(CASE WHEN ( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ) BETWEEN 15 AND 30 THEN 1 ELSE TO_NUMBER(NULL) END) as 91_to_120_Days,
    COUNT(CASE WHEN ( TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE) ) BETWEEN 0 AND 14 THEN 1 ELSE TO_NUMBER(NULL) END) as 120_Days_Plus,
    COUNT(TRUNC(SYSDATE)-DISCO10G.DATE_FORMAT_TEST(A.STATUS_DATE)) as Total
    FROM PSTAGE.ALL_EQUIPMENT A,
    ( SELECT A.SITE "SYSTEM PREFIX", A.DESCRIPTION "SYSTEM DESCRIPTION", A.SITE_ID, B.SITE_DESCRIPTION, A.G2B_ID
    FROM SITE_LIST A, ALL_CF_SITE_CONTROL B
    WHERE A.SITE_ID = B.SITE_ID
    ORDER BY 1, 3
    ) B
    WHERE ( (B.SITE_ID = A.SITE_ID))
    AND (A.EQUIPMENT_STATUS_CODE IN ('T','7'))
    GROUP BY A.SITE_ID,B."SYSTEM DESCRIPTION",B."SYSTEM PREFIX"
    ORDER BY B."SYSTEM DESCRIPTION" ASC ;
    Thanks!

    Hi sunil,
    Rod is referencing the NLS parameters i.e.
    Can you please let me know which NLS parameters you are referring toNLS parameters in this scenerio may be the date and language for that session.Do check out
    SELECT * from NLS_SESSION_PARAMETERS
    how i can check if there any differences in the NLS parameters when report is scheduled or run interactivelyI think you should run the trace file.Iam not sure about it.
    It would be system_context.
    Hope it helps you.
    Kranthi.

  • "Milky" or faint results when exporting from AE to FCP

    (Accidently posted to FCP Express forum-- whoops!)
    I've been using After Effects for years now to create graphics for our Avid projects, and the QT results have always been great. Clean, sharp moving graphics. But now that I've been using FCP, I'm not exactly happy when I export my Quicktime graphics from After Effects to FCP: they're extremely "milky" and faint/fuzzy when viewed from FCP over an NTSC monitor. I have tried various codecs when exporting: DV/NTSC, Animation, Component-- all with the same results.
    I have read other threads with similar comments (even the thread that mentioned "milky" results when exporting from FCP to AE and back) but none of the suggestions/remarks helped in my situation.
    I'm sure others have experienced this. Any suggestions?
    Settings:
    After Effects comp: NTSC/DV Preset (720 x 480, lower field, etc.)
    Export Codecs: DV/DVCPro-NTSC, Animation, Component (all with the same milky results)
    Final Cut: Sequence Preset "DV/NTSC 48 Khz"
    Also tried using, as one thread suggested, the "Uncompressed 8 bit NTSC 48 Khz" preset and no difference
    Side note: I'm using Final Cut in this system outputting to both DV video and Betacam video, using an Aja card for the Beta. Both DV and Beta results look the same (going straight thru the decks-to-NTSC monitor) and they both use the same "DV/NTSC 48 Khz" sequence preset-- except where I changed it to "Uncompressed 8 bit". If I use Animation or Component as my export codec from AE, naturally, I have to render to play the clip back in the timeline. It even looks milky or faint on the FCP source/viewer screens!
    And yes, I've checked the NTSC monitor-- a Sony Trinitron PVM-20 monitor. And I've looked at the results on other monitors and even regular TVs. Milky/faint video all around.
    Any suggestions would be appreciated!!

    Is this on files with alpha channels? Have you tried
    changing the Alpha type? Are you having
    pre-multiplication problems?
    No, they don't have alpha channels. But I did try, when rendering with Animation, changing the colors to "Millions +" which was something I read on another thread. Same results.
    Basically, these are After Effects projects with simple backgrounds and moving text. I'm not doing any layering with alpha channels-- like lower third supers.
    However, whenever I use Apple programs like LiveType or Motion, the NTSC results look like they did while I was creating the projects with these programs before I rendered them.

  • "Milky" Results When Exporting from AE to FCP

    I've been using After Effects for years now to create graphics for our Avid projects, which have always been great! Now that we're using FCP, I'm not exactly happy with the results of my QT graphics exported from After Effects to FCP: they're extremely "milky" and faint when viewed from FCP over an NTSC monitor. I have tried various codecs when exporting: DV/NTSC, Animation, Component-- all with the same results.
    I have read other threads with similar comments (even the thread that mentioned "milky" results when exporting from FCP to AE and back) but none of the suggestions/remarks helped in my situation.
    I'm sure others have experienced this. Any suggestions?
    Settings:
    After Effects comp: NTSC/DV Preset (720 x 480, lower field, etc.)
    Export Codecs: DV/DVCPro-NTSC, Animation, Component (same milky results)
    Final Cut: Sequence Preset DV/NTSC 48 Khz
    Also tried using, as one thread suggested, the "Uncompressed 8 bit NTSC 48 Khz" preset and nothing better
    Side note: I'm using Final Cut in this system with both DV video and Betacam, using an Aja card. Both DV and Beta results look the same (going straight thru the decks-to-NTSC monitor).
    And yes, I've checked the NTSC monitor-- a Sony Trinitron PVM-20 monitor. And I've looked at the results on other monitors and even regular TVs. Milky faint video all around.
    Any suggestions would be appreciated!!

    You might want to post this in the FCP forum next door; this for Final Cut Express

  • HT4413 When migrating from time machine to my new hard drive, only some files and applications and setting are transferred, not all of them. In my latest back up I have them all. How can I fix that?

    When migrating from time machine to a new hard drive, not all is transferd, only partial documents, applications , settings etc. How can I migrate the latest back-up with all the content.

    sohs wrote:
    When migrating from time machine to a new hard drive, not all is transferd, only partial documents, applications , settings etc. How can I migrate the latest back-up with all the content.
    If you want to use Time Machine to recover the contents of one of its a backups to a new drive, follow the instructions in Mac OS X 10.6: Recovering your entire system. Note that you must select the "Restore System From Backup" option from the Utilities menu of the Installer disc to do this.
    Also note that if you are transferring files to a hard drive to be used with a different computer, you should use Migration Assistant instead. This intentionally will not copy everything because some settings, applications, etc. are not compatible computer-to-computer. Migration Assistant will copy everything that is.

  • HT201250 When migrating from time machine to my new hard drive, it migrates the first back-up I made several years ago. How can I migrate the latest back-up ?

    When migrating from time machine to my new hard drive, it migrates the first back-up I made several years ago. How can I migrate the latest back-up ? I need time machine to migrate the latest back-up. Should I delete the older back-ups ?

    As noondaywitch says, it should use the latest backup.
    Where are your backups (external HD, Time Capsule, etc.)?
    It sounds like there are two separate sets, and you're not connected to the right set.

  • Report Viewer shows incorrect data when viewing pages from last to first

    Post Author: Fmorales
    CA Forum: .NET
    Hello.
    I've made a huge report with Crystal Reports for Visual Studio 2005, and sometimes the Report Viewer show data with errors.
    If I see all pages of my report in order, 1 first, then 2nd, 3, 4... until the last one.... The report is always correct.
    If I see all pages in reverse order, 1 first (shown by default), then last one, then last one-1.... until 2nd.. All years show incorrect, except first one... 
    In an outer section, for every year, there is a final row which shows summarize calculated data. The error consists in that every value of the row is 0.
    It seems that Crystal Report calculates while showing, that's good.. but... Why does it ignore the data before when I see directly the last page?? It forces me to see all pages one by one in ascendant order to ensure data is correct.. I must fix that error.
    The way I calculate data in the problematic summarize row is a bit complicated, but I'll try... Let's focus in one only column (the other ones are similar). The summarize value is a formula which simply show a global value :
    WhilePrintingRecords;
    CurrencyVar margenActual;
    which is being increasing or decreasing along the group:
    WhilePrintingRecords;
    CurrencyVar actual:=actual+CurrentFieldValue; 
    if {PresupPeriodifMesesAux_DS.TIPO} = 'PAGOS' then         CurrencyVar margenActual:=margenActual-CurrentFieldValueelse    CurrencyVar margenActual:=margenActual+CurrentFieldValue;
    DefaultAttribute
    It is placed in the backgrond property of a CrossTab cell in a hidden pre-section... Well.. I know it's a bit complicated, but I have to do that way because it was the only trick I found to make a summarize file before printing data summarized (that's why the line "CurrencyVar actual:=actual+CurrentFieldValue;" appeared in formula). So I also wanted to use this formula to acummulate "margenActual".
    In the inner section I reset the actual value (this value always go fine):
    WhilePrintingRecords;
    CurrencyVar actual:=0; 
    Before end of year I reset the margenActual value:
    WhilePrintingRecords;
    CurrencyVar margenActual:=0; 
    I've tried multiple combinations (using WhileReadingRecords instead WhilePrintingRecords) but data is incorrect or I cannot get rid of visualization page's problem....
    Any idea?
    Thanks a lot

    quote:
    Originally posted by:
    ntsiii
    If you were previously using <mxXML> you WERE using
    e4x.
    So remove that tag, create an instance variable of the same
    name, typed as xml, and in your result handler, do as VarioPegged
    suggests, though I would cast/convert to xml first:
    companies = XML(event.result);
    trace(companies.toXMLString()); to look at your xml
    var xlCompanies:XMLList = xmlCompanies..company; //all such
    expressions return XMLList, never XML
    trace(xmlCompanies.length()); //
    Tracy
    Ok so the ID of the mxXML was being interpreted as an E4X
    variable at compile time?
    I tried changing the name of the ID of the HTTPService call
    from "marketData" to "MDATA" and assigning the variable marketData
    to the result of the HTTPService query, which if I understand you
    correctly should basically make everything work as it was before,
    but it seems to be a problem.
    when I try to run it puts an exclamation point on this line
    <toolbox:TreeMap id="treeMap" width="1200" height="800"
    dataProvider="{marketData}"
    labelField="@cname" weightField="@amount"
    colorFunction="{itemToColor}"
    toolTipFunction="{itemToToolTip}"/>
    That code refers to a SWC file. Apparently it wants
    marketData to be a data provider. If I change the dataProvider
    reference above to "MDATA" (the ID of the HTTPService) the App
    compiles, but I get two errors at runtime:
    TypeError: Error #1009: Cannot access a property or method of
    a null object reference.
    ReferenceError: Error #1081: Property @age1 not found on
    mx.rpc.http.mxml.HTTPService and there is no default value.
    What should I change this reference to? It won't compile if I
    use the variable I made for the e4x results and it is reading
    gibberish if I have it read directly from the
    HTTPService....?

  • WebI displays incorrect dates when sourced from SAP

    We have several issues, all tied to displaying dates from a BEx Query, through the universe, into WebI.
    Scenario One:  Dates that have a datatype of date will parse in the universe, but will give driver not capable when used in WebI.  Could this be tied to an invalid date?
    Scenario Two:  Dates set with date datatype parse correctly and can be queried in WebI, but return incorrect results. If queried WITHOUT a measure, date appears as one day less than actual date (ex. SAP date  = Apr 28, 2009 but universe object set with date datatype shows April 27, 2009.  When a measure is added, the same date displays as Sept 27, 1976.
    I suspect that we need to modify the data access files in order to accurately convert SAP dates (which by default come into the universe as Character) to a date datatype. If this is the case, are there sample sapen.prm and sap.sbo files to ensure appropriate settings? 
    Does anyone have additional thoughts on what could be causing this issue?  Are there sample sapen.prm and sap.sbo files anyone would be willing to share?
    Thanks!

    Hi Robin,
    If you are using BOE XI 3.1. Then make sure that you apply fixpack 1.4 on it because the issue you are Describing is Fixed in this fix pack.
    Here is the Description of that Particular issue In Release Notes of Fix pack 1.4
          ADAPT01181134
          Description:
          When users create a Web Intelligence document with the universe which is built based on SAP data, it fails to display correct values for some Date objects. This problem occurs when users have a timezone of 'GMT-x hours' on the machine where BusinessObjects Enterprise is installed.
          I hope this would solve your problem.
    Thanks,
    SK.

  • Incorrect Results When Using an In-Line View and User Function in 10g

    My developers are complaining of incorrect Select statement results when using an in-line view along with a user defined function. Below is the statement:
    select test_f(wo1)
    from
    (SELECT a.WORK_ORDER_NBR, b.work_order_nbr wo1/*, facility_f(A.FACILITY),
    A.PLANNER, A.WO_STATUS, mil_date(A.WO_STATUS_DATE)*, A.WORK_ORDER_TYPE,
    A.WO_DESCRIPTION
    FROM TIDWOWRK A, TIDWOTSK B
    WHERE B.WORK_ORDER_NBR(+) = A.WORK_ORDER_NBR))
    where wo1 is null;
    Test_f() is a user defined function and the above query returns thousands of rows. It should return 308 rows. It is apparent that the target database is not evaluating the "where wo1 is null;" clause.
    select to_char(wo1)
    from
    (SELECT a.WORK_ORDER_NBR, b.work_order_nbr wo1/*, facility_f(A.FACILITY),
    A.PLANNER, A.WO_STATUS, mil_date(A.WO_STATUS_DATE)*, A.WORK_ORDER_TYPE,
    A.WO_DESCRIPTION
    FROM TIDWOWRK A, TIDWOTSK B
    WHERE B.WORK_ORDER_NBR(+) = A.WORK_ORDER_NBR))
    where wo1 is null;
    In the above query return 308 rows. The user function was replaced by an Oracle function. The Where clause is now evaluated correctly.
    The query is executed from an Oracle 10g R2 database and retrieves data from a 9.2.0.6 database.
    I've seen a little information on Metalink. It appears that there was some trouble in 9i, but were fixed in a 9.2.0.6 patch. I don't see any information about a 10.2.0.2 database.
    Anyone have any experiences or a successful solution. I suspect that I will need to report this to Oracle and wait for a patch.
    Thanks,
    John

    I can only think of two reasons for this behaviour:
    1) You are executing these two queries from two different users and there is some policy on the table.
    2) The function doesn't do an upper, but returns null a lot of times, even when the input is a not null value, like this:
    SQL> create table tidwowrk
      2  as
      3  select 1 id, 'A' work_order_nbr, 'DST' facility from dual union all
      4  select 2, null, 'TRN' from dual union all
      5  select 3, 'C', 'DST' from dual
      6  /
    Tabel is aangemaakt.
    SQL> create table tidwotsk
      2  as
      3  select 'A' work_order_nbr from dual union all
      4  select 'B' from dual
      5  /
    Tabel is aangemaakt.
    SQL> create or replace function test_f (a in varchar2) return varchar2
      2  is
      3  begin
      4    return case a when 'A' then null else a end;
      5  end;
      6  /
    Functie is aangemaakt.
    SQL> select count(*)
      2    from ( SELECT a.WORK_ORDER_NBR
      3                , test_f(b.work_order_nbr) wo1
      4             FROM TIDWOWRK A
      5                , TIDWOTSK B
      6            WHERE B.WORK_ORDER_NBR(+) = A.WORK_ORDER_NBR
      7              and a.facility in ('DST', 'TRN', 'SUB')
      8         )
      9   where wo1 is null
    10  /
                                  COUNT(*)
                                         3
    1 rij is geselecteerd.
    SQL> select count(*)
      2    from ( SELECT a.WORK_ORDER_NBR
      3                , to_char(b.work_order_nbr) wo1
      4             FROM TIDWOWRK A, TIDWOTSK B
      5            WHERE B.WORK_ORDER_NBR(+) = A.WORK_ORDER_NBR
      6              and a.facility in ('DST', 'TRN', 'SUB')
      7         )
      8   where wo1 is null
      9  /
                                  COUNT(*)
                                         2
    1 rij is geselecteerd.Regards,
    Rob.

  • Query not showing detailed result when run through query Designer or Portal

    Hi,
    There is one query which not showing detailed result while running through Query Designer or run in Portal.
    But strange thing is that it is showing the detailed result when i run it through BeX Analyzer.
    While all the other queries don't have this problem in system. All showing the correct detailed result.
    If anyone have some idea on this issue plz let me know.
    Regards,
    Javed
    Edited by: Javed Akhtar on Jul 7, 2009 3:59 PM

    Hi,
    We can do this setting in WAD. Please check the web template and try to remove that setting. When you have hierarchy then we can display only till certain level in portal, this setting is done in web template APIs, but in bex analyzer you can see all the detailed information.
    Edited
    Go through this thread for some more detailed information
    http://help.sap.com/saphelp_nw2004s/helpdata/en/44/7b5f0a95ce12d0e10000000a422035/frameset.htm
    Regards,
    rik

  • Linux net command showing incorrect output if executing from java.

    I am trying to execute a net rpc registry on red hat linux box from java using Runtime. I have stored the command in a String variable. When the execute the command from java it throws an error saying that "Invalid registry path" however the same command works fine when executed from linux command terminal.
    CODE
    import java.io.*;
    public class ChkBpower {
         public static void main(String[] args) {
         checkBpower(128);
         public static void checkBpower (int TTL){
              int ttl = TTL;
              System.out.println("Hello3");
              String ip = "20.198.36.28";
              String[] reg={"\\","HKLM","\\","SOFTWARE","\\","Marimba"};
              System.out.println(reg);
              String credentials ="bpwrlab/Administrator%Confmgmt1";//"asiapac/gjagdeosingh%M@nu2281";
              String chkBcmd = "net rpc registry enumerate '\\HKLM\\SOFTWARE\\Marimba' -I " + ip + " -U " + credentials ;
              String chkBstatus = "net rpc service status cscmarimba -I " + ip + " -U " + credentials + "| grep -b 'service' | awk '{print $4}'";
              String startBpower = "net rpc service start cscmarimba -I " + ip + " -U " + credentials;
              if (ttl>=100 && ttl<=128){
              System.out.println(ttl);     
              System.out.println(chkBcmd);
              try {
                   Runtime r = Runtime.getRuntime();
                   Process p = r.exec(chkBcmd);
                   InputStream stderr = p.getErrorStream();
         InputStreamReader isr = new InputStreamReader(stderr);
         BufferedReader br = new BufferedReader(isr);
         String line = null;
         System.out.println("<ERROR>");
         System.out.println(br.readLine());
         while ( (line = br.readLine()) != null)
         System.out.println(line);
              System.out.println("</ERROR>");
              int exitVal = p.waitFor();
              System.out.println("Process exitValue: " + exitVal);
              catch (Throwable t)
         t.printStackTrace();
    }

    Use exec(String[]), not exec(String), whenever you have argue,nets. Saves all that mucking around and second-guessing and escaping ...

  • How do I create a recovery partition when restoring from Time Machine?

    I am planning to replace the HDD in my Macbook Pro with an SSD. I've used Time Machine to backup my HDD (running Mountain Lion) but am trying to find the best way to restore my Time Machine backup to the new SSD once installed.
    Given that the new SSD will not have a bootable OS X Recovery partition, I have created a bootable OS X Recovery drive on a USB thumb drive using OS X Recovery Assistant.
    In order to ensure that the new SSD has the OS X Recovery parition, should I:
         (1) reinstall Mountain Lion on the SSD then recover my data from Time Machine; or
         (2) can I simply use the Restore from Time Machine option in OS X Recovery to do it all at once.
    I can't seem to work out whether option (2) will create the OS X Recovery partition on the new SSD or just recover the system partition.

    Turns out the OS X Recovery partition is only created on a fresh install of OS X. Restoring via Time Machine will not do the trick.

  • No recovery mode available when recovered from Time Machine

    My MBP has been really annoying ever since I bought it last year; every 1-2 months, HDD file structure is completely messed up which is beyond Disk Utility's recovery capability.
    So I need to restore entire system from Time Machine after formatting the internal HDD, but every time I do, there is no way to reboot it to the recovery mode (command + R) and always end up with the Internet Recovery.
    The only way to get the recovery mode available again is, so far, download the entire OS again and re-install it.
    But it is quite time consuming and I would like to minimize the complete recovery time (total recovery time including recovering files from Time Machine and re-install Mountain Lion mounts to 10 hours or longer and I need to do it roughly every month...)
    Does anyone have any good way to avoid the re-installation step?
    Thank you.

    If your system will not load the local Recovery HD partition then you will need to download and reinstall the OS again to get it working (and likely both partition and format the drive as well).
    If you are simply trying to restore a Time Machine backup, then you can use the Internet Recovery to do so, by choosing the option from the OS X Tools interface and then choosing a backup instance on your TM drive to restore.

  • HT204150 Why does iCal show incorrect age when displaying birthdays derived from Addressbook

    Why does iCal display incorrect ages derived from AddressBook entered birthdays?

    Hi PeterWCM, for what it's worth, the Apple help desk in Oz reckons we've uncovered a tech glitch in the software and that they replicated the described faults! But it only happens between specific dates (sometime in early Nov 1974, and runs through to today!)i.e; dates before Nov '74 aren't affected and some dates since!
    We "trouble shooted" by inserting (made-up) dates in Addressbook and then watching when iCal updated. By a process of trila and error we nailed down the start of the problem to 2nd Nov '74!
    Anyhow, they seemed to think there would be a "patch" issued in Jan...?
    It MAY still be linked to timezone probs...not really sure!
    Please let me know if you find a solution?
    Cheers!

  • Math function ' ' on Date columns is showing incorrect results. Pls xplain!

    Hi guys,
    I'm having a query wherein two date columns are used. One holds just the date part and the other date+time.
    Columns are: - processing_date (holds on date)
    authorised_ts (holds date+time)
    The query is : -
    SELECT a.processing_date,a.authorised_ts,
    SUBSTR(a.processing_date,1,9),SUBSTR(a.authorised_ts,1,9)
    FROM TEBINS01 a WHERE a.ref_instty_code = 'BULK'
    AND a.status_code = 'PPAY'
    AND SUBSTR(a.processing_date,1,9) < SUBSTR(a.authorised_ts,1,9)
    I know that the substr function is creating the problem as it is converting the columns into characters.
    *****The results show that 22-NOV-04 is greater than 12-JAN-05****
    I've tried to use the below query to convert the above 2 dates into number(using to_number) via: -
    SELECT TO_NUMBER(SUBSTR('22-NOV-04', LENGTH(RTRIM('22-NOV-04','1234567890'))-LENGTH('22-NOV-04'))) FROM dual
    The result is 4
    and when I use the above query for 12-JAN-05 the result is 5.
    So even when I convert to number 5 is definitely greater than 4. But how and why is the substr function in the original query giving the wrong results?
    Thanks in advance guys
    B

    As David points out, if the two columns are stored as dates, then you do not need to convert them at all to compare them. The only possible issue may be the fact that processing_date has no time component and authorised_ts has a time component.
    Given the following:
    SQL> DESC t;
    Name                                      Null?    Type
    ID                                                 NUMBER
    PROCESSING_DATE                                    DATE
    AUTHORISED_TS                                      DATE
    SQL> SELECT * FROM t;
            ID PROCESSING_DATE      AUTHORISED_TS
             1 10-Aug-2005 00:00:00 09-Aug-2005 03:51:47
             2 06-Aug-2005 00:00:00 11-Aug-2005 07:44:42
             3 10-Aug-2005 00:00:00 08-Aug-2005 17:18:07
             4 08-Aug-2005 00:00:00 09-Aug-2005 11:45:59
             5 12-Aug-2005 00:00:00 08-Aug-2005 12:56:49
             6 06-Aug-2005 00:00:00 10-Aug-2005 01:43:02
             7 08-Aug-2005 00:00:00 07-Aug-2005 09:23:19
             8 10-Aug-2005 00:00:00 10-Aug-2005 11:04:21
             9 05-Aug-2005 00:00:00 08-Aug-2005 11:29:47
            10 11-Aug-2005 00:00:00 07-Aug-2005 14:51:53You obvioulsy would want id's 2, 4, 6, and 9, but what about 8? The two dates are on the same day. If you only want to consider cases where the day is less (i.e. exclude id 8) then you should query:
    SQL> SELECT * FROM t
      2  WHERE processing_date < TRUNC(authorised_ts);
            ID PROCESSING_DATE      AUTHORISED_TS
             2 06-Aug-2005 00:00:00 11-Aug-2005 07:44:42
             4 08-Aug-2005 00:00:00 09-Aug-2005 11:45:59
             6 06-Aug-2005 00:00:00 10-Aug-2005 01:43:02
             9 05-Aug-2005 00:00:00 08-Aug-2005 11:29:47However, if you hink that id 8 should be included then it is simply:
    SQL> SELECT * FROM t
      2  WHERE processing_date < authorised_ts;
            ID PROCESSING_DATE      AUTHORISED_TS
             2 06-Aug-2005 00:00:00 11-Aug-2005 07:44:42
             4 08-Aug-2005 00:00:00 09-Aug-2005 11:45:59
             6 06-Aug-2005 00:00:00 10-Aug-2005 01:43:02
             8 10-Aug-2005 00:00:00 10-Aug-2005 11:04:21
             9 05-Aug-2005 00:00:00 08-Aug-2005 11:29:47Note that the comparision does not depend on the display format of the date:
    SQL> ALTER SESSION SET nls_date_format = 'mm/dd/yy';
    Session altered.
    SQL> SELECT * FROM t
      2  WHERE processing_date < TRUNC(authorised_ts);
            ID PROCESSI AUTHORIS
             2 08/06/05 08/11/05
             4 08/08/05 08/09/05
             6 08/06/05 08/10/05
             9 08/05/05 08/08/05HTH
    John

Maybe you are looking for