LAG function doesn't works correctly changing aggregates level

Hello there,
I'm trying to use the function in Discoverer Desktop but i'm experiencing some problems.
First of all i will explain what i'm trying to do.
I've to treat data from a typical business datawarehouse and i want to show in the same worksheet both the totals,year fixed (calculated partitioning by months and other fields of dimensions ) for the current year and for the passed year.
I've done this by making a summary table that calculates SUM(import) grouping by some fields and a LAG(SUM(Import),1)over (partition by <fields> order by year ASC).
This last expression effectively returns the sum of the passed year.
The problem is from now on: if i want to roll up over a hierarchy i noticed that some values of the totals of the passed year are different from the import calculated by the simple SUM (of course changing the year... :-) ) ... Mining inside the data i discovered that some there were some rows filled in the SUM column that were empty on the LAG column. This is because running the query, if there isn't any row resulting by aggregating on a certain year and month, it cannot be any calculation for the LAG, and the result is an empty entry for the LAG (but it's not correct).
Does someone know a workaround or some function like LAG that is not affected by this problem?
Many thanks in advance for any kind of help
Greetings to all

You might want to user NVL() before SUM()
Ex:
LAG(SUM(NVL(Import,0)),1) over()
Use NVL wherever you use SUM, because:
1+NULL = NULL
Hope this helps :)

Similar Messages

  • File download "save as" function doesn't work correctly

    I am using Firefox 24.3.0 ESR on Linux LXLE 12.04.3. I have problems downloading some files from some sites. After some investigation I found that the files have been given the generic MIME type octet-stream by the server. Presumably this is to encourage me to download the file rather than have it open automatically in the browser.
    For instance, if downloading one of these files that is a pdf file, left click gives me the standard box that allows me to choose to open the file in the default application or "save as". Once I do the left click, I can see that the file immediately starts to download in the background (network activity). If I wish to open it in the default application, it works. The green download arrow flashes and eventually the default application opens with the downloaded file when the download is complete. The download is then listed in my download library.
    If I select "save as" and my preference is set to download files to a fixed directory, it ignores the directory they should go to and places them in my home directory. The green download arrow flashes and again records the download in the download library.
    If I set the preference to "always ask me where to save files" then when I click on "save as" nothing happens. The green download arrow doesn't flinch and nothing appears in the download library.
    After hunting around I found that the file has actually downloaded to my /tmp directory. Clearly that was the background activity mentioned above. The name of the file in the /tmp directory is made up of seemingly random characters and I can retrieve it from there but this isn't exactly ideal and I would like this to work the way it is supposed to. i.e. I want to be able to click on "save as" and select where I want the file to be downloaded to (and it to go there).
    What could be causing this behaviour and how do I get the "save as" function to work?

    jscher:
    Thanks. The /tmp and home directories are on the same partition as the main operating system. The Downloads directory is actually set up as a sub-directory of the home one but is a symbolic link to a NAS drive. It works fine for other MIME types. It is just when web sites use the application/octet-stream MIME type that I get this problem.
    I checked the permissions and the /tmp and Downloads directories have full read write permissions for everyone. The home directory is the one with the restriction that only I can write to it.
    So, I don't expect that sheds any light on the problem.
    cor-el:
    Thanks. I meant to say in my first post (but pressed the button before it got in) that I actually created a completely new Firefox profile and the problem is still there. Sorry, I should have included that.
    The only difference with the fresh profile is that the "open in default application" isn't available, presumably because no default application has been assigned. The "save as" behaviour is still the same.
    So, if the problem exists in a pristine profile, it looks like there is something deeper wrong.

  • I recently downloaded 6.1.2 and am regretting it...for one reason...the search function no longer works correctly. !!

    I personally and professionally rely on text messaging extensively. Since upgrade, the search function doesn't work correctly. It only returns partial results. This has never happened with previous upgrades.  All the old texts are there but it does not search the entire history.  If i compose new text and duplicate the recipients from an old text, it will bring up string...just cant search for it.  PLEASE HELP SOMEONE.

    HarryAustralia wrote:
    I recently updated my ipad wifi only to the new ios 6.1.2 and initially I had the auto cover lock option which can be seen in the Generals tab, but then it stoped working!! Before the update, the auto cover lock worked fine. So after trying all the options, I then did a complete reset on the ipad and now its gone all together from the General tab!! I can no longer see the "auto cover lock" option.
    The iPad cover lock is for when you use a cover with magnets in it to lock and unlock the iPad when you close the cover or open it. Try running a refrigerator magnet along the sides of the iPad and see if that trips the iPad Cover Lock back into the settings.
    That is not the same thing as the iPad Auto Lock setting which allows you to set an allotted time before the iPad goes to sleep.
    You can try resetting all settings to see if the Auto Lock feature retinrs to the iPad.
    Settings>General>Reset>Reset All Settings. You will have to enter all of your device settings again.... All of the settings in the settings app will have to be re-entered. This can be a little time consuming re-entering all of the device settings again.

  • The to_date function doesn't work ?

    Hello
    I don't know why my to_date function doesn't work on my pc.
    my statement is pretty complex so i just tried simple one
    select to_date('10-Jan-2006','dd-mon-yyyy') from dual;
    but even this one doesn't work it says it is invalid month
    howcome?
    is it because my Windows XP (not english version) doesn't recognise month Jan?
    i tried it another place it worked
    so is there any language pack / patch i need to install? ?
    so does OS matters?
    or how to fix this..please help me

    By default SQL Developer picks up it's language settings up from (on Windows) the Regional and Language Options. You can see what it has set by querying the NLS_SESSION_PARAMETERS view.
    Assuming you don't want to change to using DD-MM-YYYY formats for your months or change your regional settings on your PC, you need to tell SQL Developer which language you want, which you can do by adding the following lines to the file sqldeveloper\jdev\bin\sqldeveloper.conf:
    AddVMOption -Duser.language=en
    AddVMOption -Duser.country=US

  • AddChild doesn't work correctly in 11.9

    comparing the two releases listed below, somehow my Flash program doesn't work correctly on the latest version anymore, nothing was changed in my program but after upgrading to the latest Flash Player, it doesn't work properly anymore, specifically, the items I add through the addChild method doesn't appear properly, was there any changes in between these versions that could have affected the addChild behavior? I'm testing with Windows  7 IE debug version and I see no script errors
    Released 10/8/2013) Flash Player 11.9.900.117 (156.2 MB)
    (Released 9/24/2013) Flash Player 11.8.800.175 (Win IE only) (50 MB)

    Could you please open a new bug report on this over at bugbase.adobe.com?  When adding the bug, please include sample code, test url or a test swf so we can quickly test this out internally.  If you'd like to keep this private, feel free to email the attachment to me directly ([email protected]). 
    Once added, please post back with the bug URL and I'll investigate internally.
     

  • Link on my website doesn't work correctly on my iMac. It works correctly on Safari, and both browsers on my laptop.

    Link on my website doesn't work correctly on my iMac. It works okay when using Safari. It also works correctly on my laptop using either browser.

    We worked out my problem. My solution turned out to be: Firefox Preferences/Applications. Scroll down until you find "Portable Document Format (application)", click on it and use the dropdown menu to the right and changed "Save file" to "Use Adobe Acrobat Pro (default). I had trouble at first finding if the listing was under Adobe, Acrobat, or what so I used the search feature and found it immediately.
    Hope this helps.

  • Game Center doesn't work correctly

    Game Center on iPod Touch 2nd Gen doesn't work correctly under iOS 4.2.1
    It shows wrong language (Englist but not my native language. My region setting is right and the system language right too.)
    Besides, the "Games" page only has a button "Find Game Center Games", while it should show my Game Center Games.
    The Friends page shows all my friends. But when I press a friend the sub page doesn't show the game my friend and I have in common.
    I've restored my device several times, but it didn't help.
    How to solve it?

    I've had exactly the same problem on my 2nd gen since early May when it just stopped working out of the blue.
    There are a few threads here on the subject. I believe that every 2nd gen is affected as I've yet to hear a 2nd gen owner say that theirs works.
    Other than waiting for Apple to fix it I don't think there is a solution.

  • Cannot print with a Samsung ML2160 printer (mono laser) and Pages. Print function doesn't work, only drag and drop in printer's queue

    Hello,
    I just purchased a Samsung ML2160 printer and it doesn't work with nor my Pages program, nor the Preview (to print PDF). No matter the way I tried, the Print function doesn't work and I cannot neither print or even enter the printer preferrences menu! My MacBook Pro has worked before with other printers, but now with the Samsung it doesn't work at all... Though, if I drag and drop a document, jpg, pdf in the printer queue, it prints just fine, but that method gives me absolutely no freedom to the printing... Could it be something from the Computer -> Machintosh HD -> Library -> Printers? Because a friend of mine was recently trying to save me some disk space, and therefore erasing part of the HP printer (to remove the previous printer I owned)...
    If anyone has any idea, that would be much appreciated
    Thank you in advance

    Do the sensible thing, as you say neither Preview nor Pages print, try other programs eg TextEdit. If none of them print then it is a System problem and very likely the printer drivers are AWOL or were never installed.
    Go to Samsung's website and download their software for the Mac:
    http://www.samsung.com/uk/consumer/print-solutions/print-solutions/mono-printers /ML-2160/XEU-support
    http://www.samsung.com/uk/support/model/ML-2160/XEU-downloads
    Peter

  • Since I got my new fixed disk my scan function doesn't work (HP Photosmart Premium All-in-One-Drucker - C309g), what should I do

    since I got my new fixed disk my scan function doesn't work (HP Photosmart Premium All-in-One-Drucker - C309g), what should I do

    Check whether you have the latest driver:
    Printer and Scanner software available for download:
    http://support.apple.com/kb/HT3669?viewlocale=en_US

  • I upgraded my 3 yr old iMac to Snow Leopard and now my HP C4150 Scanning function doesn't work (not recognized).  I downloaded updated Drivers from the HP site, but still no joy.  Any suggestions?

    I upgraded my 3 yr old iMac to Snow Leopard (OS X 10.6) and now my HP C4150 Scanning function doesn't work (not recognized).  I downloaded updated Drivers from the HP site and installed them, but still no joy.  Any suggestions?

    aspaceman,
    Perhaps I owe you an apology.   Having re-read that downloading from HP was unsuccessful I feel uncomfortable.  Can I suggest you update your 10.6 system (as noted in your profile) to 10.6.8 (if it is not already there) by using the
    Mac OS X 10.6.8 Update Combo v1.1 combo update plus any software updates that then apply.  

  • Lightroom 5.7.1, Yosemite OS X - Synchronise Folder function doesn't work in Lr. Is there a compatibility issue? I can see the folders/images in Finder but when trying to synchronise folders in Lr it does not recognise that there are any images and theref

    Lightroom 5.7.1, Yosemite OS X - Synchronise Folder function doesn't work in Lr.
    Is there a compatibility issue? I can see the folders/images in Finder but when trying to synchronise folders in Lr it does not recognise that there are any images and therefore unable to import to catalogue. Anyone has any idea how to make it work. Thanks a lot.

    Hi Elba,
    Thank you very much for your reply. Not sure, however, that we are talking about the same problem.
    I am trying to perform the same function in Lr that I have been doing for many years in the past and has only been a problem in the last few days (possibly coinciding with upgrading to Yosemite, trying to find out whether that is the problem)
    I am not intending to sync any files with Creative Cloud but only trying to use 'Synchronize Folder' function in Lr. Normally, I would right click on a particular folder in Lr catalogue and click on that function to check that the Lr Catalogue is perfectly matching my drives where the original photos are actually stored.
    The problem that I only started to encounter is that I can see the files on the actual drives but they do not appear in my Lr Catalogue and they are completely invisible to Lr. I simply can not get Lr to recognise them and then import them to catalogue.
    If for example, I export images to Ps and then save and close them, they do appear on my drive but are invisible to Lr and I can't get them imported into the catalogue. Import to folder also not producing any results as they are still invisible to Lr.
    Completely baffled by it. Any idea what could be the reason?
    Kind regards,
    Nik

  • IPhoto doesn`t work correctly with german "umlaut" (ä,ö,ü) in keywords

    iPhoto doesn`t work correctly with german "umlaut" (ä,ö,ü) in keywords. They get to ä̈,ö̈, ü̈ when I write the keyword a second time. Can anybody tell me why. Thank you. Heinz

    It apparently does not like non-standard English characters - use A-Z and 0-9 adn you should be OK
    report to Apple - iPhoto menu ==> provide iPhoto feedback
    LN

  • After upgrade my iphone 4 to IOS6, sound doesn't work correctly

    After upgrade my iphone 4 to IOS6, sound doesn't work correctly.
    During a phone call, there is no sound. But if I turn on the speaker, there is sound. itune works fine since it's on the speaker.

    Dear All
    i have done the same activity ( buy a new iphone 4 -> upgrade to ios5 - > configure email) with success-
    than when i start to move the contacts from old mobile to iphone (using the microsim) i receive the same crash
    in disgnosis e use i saw 2 dump with this title 'latestCrash-Preferences.plist and LatestCrash.plist. in each file the date is the same and i read:
    Exception Tyle: EXC_CRASH (SIGABRT)
    Exception code: 0x00000000, 0x00000000
    Chrashed Thread: 6
    in thread 6: name: Dispatch queue:
    com.apple.addressBookUI.ContactsSettingPlugin
    and thaan a lot of data.
    Have you any idea?
    thank in advance
    Fabio

  • Translation from CS5 to Cloud doesn't  work correct, navi and linked images are broken.

    Translation from CS5 to Cloud doesn't  work correct, <navi> and linked images are broken.
    The data of CS5 was created at another PC. I installed Cloud version into two different PC. One has had the site data since dreamweaver CS5 and it works correct in Cloud version. Another PC got the site data from remote server and it doesn't work correct. <navi> and linked image are broken.

    Another PC got the site data from remote server and it doesn't work correct. <navi> and linked image are broken.
    This implies your site is not properly defined in DW.  Go to Site > Manage Sites.
    Or simply go to your other installation of DW and export the site definition file from Manage Sites.
    Save it to a flash stick or other removable drive.  Then import the STE file into your 2nd installation of  DW.
    Nancy O.

  • ITunes 10.4 full screen with Win7-64bit doesn't work correctly.

    iTunes 10.4 full screen with Win7-64 doesn't work correctly. I have the Windows taskbar on the left side of my screen. Maximized iTunes is panned to the left.

    Same issue here. When the Windows taskbar is position on the top of the screen and then the iTunes windows is maximised, it's position is as if the Windows taskbar is at the bottom of the screen so the top of the iTunes window sits under the taskbar.
    For those wanting a workaround, hold shift and right click the iTunes icon in the taskbar/quick launch bar and click restore, at least then you can adjust it to be full screen manually.
    System:
    Windows 7 Ultimate x64
    iTunes 10.4
    ATI 5750 video card

Maybe you are looking for

  • In need of a Mighty Mouse Track Ball

    Something small and hard, fell in the mouse track ball area and while i was pressing it (upside down) on a piece of paper to clean it, that little hard piece of dust, carved the surface of my track ball making it unable to scroll without jumping arou

  • How to load delta to 2 target ODS 's from a single ODS using process chains

    Hi BW Gurus I am having a current ODS based on 2LIS_02_SCL, deltas also are working fine for it. our  requirement was based to have 2 target ODS on this existing ODS by using export generate datasource. I have to build a process chain that should ena

  • Universal software....

    I just switched and I need Photoshop Elements. I see they have a mac version 4.0 for $80. How do I know if this is a universal app which is supposed to work better on my intel machine? If it is not, am I better off waiting for one to come out?

  • CF 8 / Vista / DW CS3

    I am so frustrated I'm ready to take a huge hammer to my laptop. I just upgraded to Vista, installed CF 8 and DW CS3, and now I can't browse .cfm pages in my browser. I am getting the following error: Server Error in Application "Default Web Site" HT

  • Can I use only 3G without 2G ??

    Hello everybody! Some questions: 1. Can I use only 3G?? 2. How to send USSD from iPAD2. For example I need to check ballance. 3. Can I use iPAD2 as modem for PC? 4. Can I use iPAD2 like mobile phone? Thanks!