Hierarchies - How can transaction data be spillited as per different levels

Hi,
Every One.
I have issue splliting data in diffrent leves of hierarchy,how it can be resolved!
In detail,if i say
We are getting all transaction and master data in flat file.
Master Data is in the format- Global Parent ID,Global ID,Local ID,Company ID
Transaction Data in the format as givn below-
Local ID,Company Id,Total Spend.
To get the drill down facility,we have added hierarchy as- Global Parent ID->Global ID->Local ID->Company ID
It is not spilliting in different levels,say total spend is fixedin  Local ID,Global ID and Parent ID.
if we have total spend 500 in some company(say ABCL),its every where same.So the purpose of drill down is not resolved.
Say spend 500 shd be splitted in different Local ID,then In different Global ID and in every level,finalll giving overall total.
Any suggesstions!
Its high priority issue.

If I understand the description and the query correctly, you are joining the budget with monthly values with the view that has daily values. This means that you get one row in the budget for each row in the daily data. So when you sum, you count the same
month many times...
Thus, you need to aggregate before the join, as in this example:
WITH oms_values AS (
   SELECT Marknad, Distrikt,
          SUM(CASE WHEN convert(char(6), [Posting Date], 112) <=
                        convert(char(6), Getdate(), 112)
              THEN [CY LC]*-1
              ELSE 0
           END) AS "CYLC",
          SUM(CASE WHEN convert(char(6), [Posting Date], 112) <=
                        convert(char(6), Getdate(), 112)
              THEN [CY-1 LC]*-1
              ELSE 0
           END) AS "CY1LC"
    FROM  Vy_omsattning_per_marknad_och_distrikt
    WHERE [PostingDate] > convert(char(4), getdate(), 112) + '0101'
    GROUP BY Marknad, Distrikt
), budget_values AS (
   SELECT Marknad, Distrikt,
          SUM(CASE WHEN Period <= convert(char(6), Getdate(), 112)
              THEN [Budget_LC]
              ELSE 0
           END) AS "BUDGET"
   FROM   ManadsBudget
   WHERE  Period >= convert(char(4), getdate(), 112) + '01'
   GROUP BY Marknad, Distrikt
SELECT oms.Marknad, oms.Distrikt, cms.CYLC, oms.CY1LC, mb.BUDGET
FROM   oms_values as oms
JOIN   ManadsBudget as mb ON mb.Marknad=oms.Marknad
                         AND mb.Distrikt=oms.Distrikt
I had to guess what's in the Period column in the Budget table. I'm assuming that it is on the form YYYYMM.
Note that I have changed the way you filter on the date columns. Converting to format 112 is often very powerful and helps to make the code shorter. And for the WHERE clause, this means better odds that any index will be used.
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • How can I link specific cells in two different speadsheets so the data from a specific cell in spreadsheet A automatically updates in a specific cell in spreadsheet B. It works in Xcel- Any ideas?

    How can I link specific cells in two different tables so the data from a specific cell in table A automatically updates in a specific cell in table B? It works in Xcel- Any ideas?

    (1) your title ask the way to link different spreadsheets.
    In Numberland, a spreadsheet is an entire document.
    There is no way to link different documents.
    (2) in the message, you ask the way to link different tables.
    This feature is available and is described in iWork Formulas and Functions User Guide (which is available for free from the Help menu).
    Getting the info just requires a simple search in this available resource !
    Yvan KOENIG (VALLAURIS, France) 14 mai 2011 10:37:50

  • How can access data in rman output file "daily.log"

    Hi All,
    i did use following query for rman out
    output file "daily.log" has been created,but does not exist data.
    how can access data in output file "daily.log"
    bash-3.00$ sh rmant.sh
    Recovery Manager: Release 10.2.0.3.0 - Production on Thu Jun 30 16:54:16 2011
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    connected to target database: DEV (DBID=45558086)
    RMAN> Spool log to daily.log;
    2> run
    3> {
    4> backup databas;
    5>}
    6> spool log off;
    7>
    Spooling started in log file: daily.log
    Recovery Manager10.2.0.3.0
    Starting backup at 30-JUN-11
    using target database control file instead of recovery catalog
    allocated channel: ORA_DISK_1
    channel ORA_DISK_1: sid=634 devtype=DISK
    channel ORA_DISK_1: starting compressed incremental level 0 datafile backupset
    channel ORA_DISK_1: specifying datafile(s) in backupset
    input datafile fno=00014 name=/u02/proddata/a_int01.dbf
    input datafile fno=00022 name=/u02/proddata/a_txn_data01.dbf
    input datafile fno=00023 name=/u02/proddata/a_txn_data02.dbf
    input datafile fno=00024 name=/u02/proddata/a_txn_data03.dbf
    input datafile fno=00039 name=/u02/proddata/a_txn_data04.dbf
    input datafile fno=00038 name=/u02/proddata/undo02.dbf
    input datafile fno=00027 name=/u02/proddata/a_txn_ind03.dbf
    input datafile fno=00028 name=/u02/proddata/a_txn_ind04.dbf
    input datafile fno=00012 name=/u02/proddata/undo01.dbf
    input datafile fno=00015 name=/u02/proddata/a_media01.dbf
    input datafile fno=00025 name=/u02/proddata/a_txn_ind01.dbf
    input datafile fno=00026 name=/u02/proddata/a_txn_ind02.dbf
    input datafile fno=00029 name=/u02/proddata/a_txn_ind05.dbf
    input datafile fno=00021 name=/u02/proddata/a_summ01.dbf
    input datafile fno=00019 name=/u02/proddata/a_ref01.dbf
    input datafile fno=00020 name=/u02/proddata/a_ref02.dbf
    input datafile fno=00001 name=/u02/proddata/system01.dbf
    input datafile fno=00002 name=/u02/proddata/system02.dbf
    input datafile fno=00003 name=/u02/proddata/system03.dbf
    input datafile fno=00004 name=/u02/proddata/system04.dbf
    input datafile fno=00005 name=/u02/proddata/system05.dbf
    input datafile fno=00006 name=/u02/proddata/system06.dbf
    input datafile fno=00007 name=/u02/proddata/system07.dbf
    input datafile fno=00008 name=/u02/proddata/system08.dbf
    input datafile fno=00009 name=/u02/proddata/system09.dbf
    input datafile fno=00010 name=/u02/proddata/system10.dbf
    input datafile fno=00011 name=/u02/proddata/system11.dbf
    input datafile fno=00013 name=/u02/proddata/a_archive01.dbf
    input datafile fno=00036 name=/u02/proddata/sysaux01.dbf
    input datafile fno=00016 name=/u02/proddata/a_nolog01.dbf
    input datafile fno=00037 name=/u02/proddata/izu01.dbf
    input datafile fno=00017 name=/u02/proddata/a_queue01.dbf
    input datafile fno=00018 name=/u02/proddata/a_queue02.dbf
    input datafile fno=00031 name=/u02/proddata/odm.dbf
    input datafile fno=00034 name=/u02/proddata/portal01.dbf
    input datafile fno=00035 name=/u02/proddata/sfx01.dbf
    input datafile fno=00030 name=/u02/proddata/ctxd01.dbf
    input datafile fno=00032 name=/u02/proddata/olap.dbf
    input datafile fno=00033 name=/u02/proddata/owad01.dbf
    channel ORA_DISK_1: starting piece 1 at 30-JUN-11
    channel ORA_DISK_1: finished piece 1 at 30-JUN-11
    piece handle=/sw/weekly_cum_database_DEV_t755196858_c1_s24_p1 tag=WEEKLY_CUM_DAT
    ABASE comment=NONE
    channel ORA_DISK_1: backup set complete, elapsed time: 00:32:55
    channel ORA_DISK_1: starting compressed incremental level 0 datafile backupset
    channel ORA_DISK_1: specifying datafile(s) in backupset
    including current control file in backupset
    including current SPFILE in backupset
    channel ORA_DISK_1: starting piece 1 at 30-JUN-11
    channel ORA_DISK_1: finished piece 1 at 30-JUN-11
    piece handle=/sw/weekly_cum_database_DEV_t755198834_c1_s25_p1 tag=WEEKLY_CUM_DAT
    ABASE comment=NONE
    channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
    Finished backup at 30-JUN-11
    Spooling for log turned off
    Recovery Manager10.2.0.3.0
    Recovery Manager complete.
    bash-3.00$

    i did try this but it hangs
    bash-3.00$ sh rmant.sh
    Recovery Manager: Release 10.2.0.3.0 - Production on Fri Jul 1 10:52:01 2011
    Copyright (c) 1982, 2005, Oracle. All rights reserved.
    connected to target database: DEV (DBID=45558086)
    RMAN> Spool log to 'daily' append;
    2> run
    3> {
    4> backup as backupset
    5> incremental level=0 cumulative
    6> device type disk
    7> tag "weekly_cum_database"
    8> format '/sw/weekly_cum_database_%d_t%t_c%c_s%s_p%p'
    9> database;
    10> }
    11>

  • How can transfer data from my old computer to my iMac

    How can transfer data from my old computer to my iMac

    Depends. what two computer modelss do you have? Do they both have Firewire ports and/or Thunderbolt ports? Do you have a home network with a router that has Ethernet ports available for each computer? Do you have an external hard drive available that could be used to transfer data?

  • How can transfer data to other phones or pc using bluetooth

    Hi,
    How can transfer data to other phones or pc using bluetooth.

    You don't.
    This has never been a feature of iphone/ipod/ipad

  • How can I move all my bookmarks from different Firefox profiles into one area to organize them and then place them into the different Firefox profiles?

    How can I move all my bookmarks from different Firefox profiles (would like to move whole bookmark folders at once if possible) into one area to organize them and then place them into the different Firefox profiles? This is all under one window user account, I am using windows 8.1. Even if you have information on how to do it on a different windows, it may still be helpful. Thanks for any input you have.

    Just a note about the difference between these two things:
    * "export" and "import" use an ancient HTML document format that all browsers can understand. When you import bookmarks, Firefox may place them into an Imported Bookmarks folder, or into Unsorted Bookmarks. This does not displace existing bookmarks, and Firefox does not automatically remove duplicates.
    * "backup" and "restore" use a more comprehensive JSON data file, which contains extra information about your bookmarks (such as tags) not contained in the traditional export file. HOWEVER, a restore completely replaces all existing bookmarks, so the restore feature cannot be used to merge in a set of additional bookmarks.
    Related support articles:
    * [[Export Firefox bookmarks to an HTML file to back up or transfer bookmarks]]
    * [[Import Bookmarks from a HTML file]]
    * [[Restore bookmarks from backup or move them to another computer]]
    Some users find the disk-based Windows Favorites folder a convenient way to organize bookmarks. If you do, too, and you do not need to preserve tags on your bookmarks, you could export each profile's bookmarks to HTML and import them all into IE11. Organize them in the Windows Favorites folder, then export from IE11 to HTML and import that file into each Firefox profile. See: [http://windows.microsoft.com/en-us/internet-explorer/add-view-organize-favorites].

  • How can I sum all the amount per line?

    HI,
    How can I sum all the amount per line?
    EXAMPLE:
    [code]
                                             TOTAL:
    1,000         2,000     5,200            $8,200
      400         1,200     6,000             7,600
    [/code]
    THANKS!!

    If you are sure of the number of columns that you are gonna get then you can add them to a variable and display.
    total = itab-col1 + itab-col2 + itab-col3.
    If you dunno how many columns will come , you have to use field symbols.
    Say the datatabse table has 16 columns which will contain your price and you have to calculate the sum of all those , then assign them to field symbols and calculate.
    Have a look at the following code.
    FORM GET_VALUES_FROM_COSS .
      FIELD-SYMBOLS: <FS1> TYPE ANY.
      DATA: V_COMPONENT1 TYPE I.
      V_COMPONENT1=31.  " your field of table from which amount field starts
    Cumulate the posting values of all the 16 period buckets as to get
    total production order cost. This is to handle the partial posting of
    production order values in different periods.
      DO 16 TIMES.
        ADD 1 TO: V_COMPONENT1.
        ASSIGN COMPONENT V_COMPONENT1 OF STRUCTURE COSS TO <FS1>.
        IF COSS-WRTTP EQ '05' AND COSS-KSTAR EQ C_KSTAR1.
          ADD <FS1> TO I_FINAL-PL_LABCOST.
        ELSEIF COSS-WRTTP EQ '04' AND COSS-KSTAR EQ C_KSTAR1.
          ADD <FS1> TO I_FINAL-ACT_LABCOST.
        ELSEIF COSS-WRTTP EQ '05' AND COSS-KSTAR EQ C_KSTAR2.
          ADD <FS1> TO I_FINAL-PL_MATCOST.
        ELSEIF COSS-WRTTP EQ '04' AND COSS-KSTAR EQ C_KSTAR2.
          ADD <FS1> TO I_FINAL-ACT_MATCOST.
        ELSEIF COSS-WRTTP EQ '05' AND COSS-KSTAR EQ C_KSTAR3.
          ADD <FS1> TO I_FINAL-PL_OPCOST.
        ELSEIF COSS-WRTTP EQ '04' AND COSS-KSTAR EQ C_KSTAR3.
          ADD <FS1> TO I_FINAL-ACT_OPCOST.
        ELSEIF COSS-WRTTP EQ '05' AND COSS-KSTAR EQ C_KSTAR4.
          ADD <FS1> TO I_FINAL-PL_FACCOST.
        ELSEIF COSS-WRTTP EQ '04' AND COSS-KSTAR EQ C_KSTAR4.
          ADD <FS1> TO I_FINAL-ACT_FACCOST.
        ELSEIF COSS-WRTTP EQ '05' AND COSS-KSTAR EQ C_KSTAR5.
          ADD <FS1> TO I_FINAL-PL_LABCOST.
        ELSEIF COSS-WRTTP EQ '04' AND COSS-KSTAR EQ C_KSTAR5.
          ADD <FS1> TO I_FINAL-ACT_LABCOST.
        ELSEIF COSS-WRTTP EQ '05'.
          ADD <FS1> TO I_FINAL-OTHER_PL_COST.
        ELSEIF COSS-WRTTP EQ '04'.
          ADD <FS1> TO I_FINAL-OTHER_ACT_COST.
        ENDIF.
      ENDDO.
    ENDFORM.                    " GET_VALUES_FROM_COSS
    Let us know if u need more inputs

  • How can i sync my ipod to a different computer that the one i originally started on without loosing whats on my ipod

    How can I sync my ipod to a different computer than the one I originally started it from. My other computer crashed and lost everything there. dont want to loose my pics n music on my ipod.

    If you want to get those pics and music off your ipod, you'll need to use an application like senuti:
    http://www.fadingred.com/senuti/

  • Can 2 different users with 2 different Iphones use the same itunes to backup each phone separately? if not how can I have a backup for 2 different iphones on the same laptop?

    can 2 different users with 2 different Iphones use the same itune program to backup each phone separately? if not how can I have a backup for 2 different iphones on the same laptop?

    Here is your answer:
    http://support.apple.com/kb/HT1495

  • How can I share the home folder with different accounts on the same mac?

    Hi, here's a question:
    How can I share the home folder with different accounts on the same mac?
    The whole point being not to have to install all my apps, and move all my files each time between users.
    The second thing would be to be able to modify one document on one account, and have it changed on the other account without having to copy it.
    I would like to have a pro and a private account on my mac.
    Thanks for you answers,
    Doug

    Your apps should not be installed in your home folder--they should be in /Applications where every user can access them.
    If you want to share things between users on the same Mac, use the /Users/Shared folder. Keep your home folder private. Trying to defeat the protections on the home folder subfolders just gets messy. I've never bothered to figure out all of the problems associated with it so I can't explain how to do it.
    Even with using Shared, you would need to alter the ACLs on the shared folder in order to allow both users to modify the documents.
    You must create a Group in Users & Groups and put each user in that group. Then create a folder inside /Users/Shared where you want to share the various files.
    Then, add an ACL to the shared folder that gives the group special permissions. on that folder.
    sudo chmod -R +a "<sharinggroup> allow delete,chown,list,search,add_file,add_subdirectory,delete_child,file_inherit,directory_inherit" /Users/Shared/<sharing folder>
    Replace <sharinggroup> and <sharingfolder> with the name of your group and your folder. Then, run the command in the Terminal.
    With that ACL, each user in <sharinggroup> will be able to alter the files created by any user in the group in that <sharingfolder>.
    Essentially, the client OS is not designed for true file sharing among the individual users. It is designed to isolate each user account from the others.

  • How can i use two channels to show different voltages in DAQ ?

    my problem is that when i choose different channels to read the outputs from my sensors, it ignores the channels which i have choosen 0 or 1 and it puts 0 channel only for both sensors. and the result is one same reading at both output guages, one reading is steady and the other is fluctuating. how can i make it recognize each one differently, is the proplem at my programme ? help me please
    Attachments:
    fin.vi ‏58 KB

    Greetings,
    AI Waveform Scan.vi and AI Sample Channel.vi each have a Channel(s) input. You do not have anything wired to these inputs. By default, these inputs are both Channel 0. You should wire "0" to one of these inputs and "1" to the other.
    Good luck with your application.
    Spencer S.

  • HT1420 how can i deauthorize ONE computer with a DIFFERENT COMPUTER

    how can i deauthorize ONE computer with a DIFFERENT COMPUTER?

    You can't without being at that computer, you can only deauthorize all.

  • How can I sync my iPhone on a different computer without erasing my applications? My iPhone was earlier synced with a PC which I don't use anymore. Please help with proper steps, if any.

    How can I sync my iPhone on a different computer without erasing my applications? My iPhone was earlier synced with a PC which I don't use anymore.
    On the new computer, I am getting a message that my all purchases would be deleted if I sync it with new iTunes library.
    Please help with proper steps, if any.

    Also see... these 2 Links...
    Recovering your iTunes library from your iPod or iOS device
    https://discussions.apple.com/docs/DOC-3991
    Syncing to a New Computer...
    https://discussions.apple.com/docs/DOC-3141

  • How can we take the cursor to a different sub-screen from the BADI?

    Hi,
    We have to do some validation on Header, Operation and Relationship of any work order (IW31, IW32). We have checked that validations can be done at BADI WORKORDER_UPDATE in the method u2018AT_SAVEu2019.  But user wants us to take the Cursor back to the field and screen due to which the error is coming. How can we take the cursor to a different sub-screen from the BADI?
    Thanks in Advance,
    Pranav

    You 'ran out of room' because you tried to put your entire question into what is the 'Topic line' of the post.
    This is a fairly common error, as a scan of the topic list will show, and likely due to a design flaw in the layout of the composition page.
    Most posters who make this error do so on their first post, and are able to avoid a similar misstep on their second and subsequent questions.
    Regards,
    Barry

  • How can I put a contact in two different groups?

    How can I put a contact in two different groups.  I downloaded Glite and have developed many groups, but I have some contacts that I would like to include in two different groups.  Any solutions?

    If I want to copy a contactl to another address-book I simly hold down the ctrl-key when I drag and drop

Maybe you are looking for

  • Excise Invoice for Depot

    Dear All I have a requirement where clients want to pass duty for partial quantity from GR. Kindly let me know if we can process partial quantity. We want to post excise invoice for Depot for partial quantity - RG23D to be updated I tried doing the s

  • Logical Component

    Friends,    In the solution manager Business Blue Printing....    I can see Business Processes with Logical Components attached to it.    There are various instances wherein there are some business processes with SAP R/3 4.7. There are some with ECC

  • Mapping Question orders -- cxml

    We have the following scenario where we are mapping from ORDERS05 to cXML - everything is fine to get different ship to locations on different PO line items for all suppliers but two - for these two suppliers it has to be like this : If a PO document

  • New 27" thunderbolt flicking to black

    Hi all. I just dropped $1199 on a new 27" TB cinema display to pair with my MBP. Unfortunately, i'm having the same issues I had with an older 30" cinema display on the same lapto: when using Photoshop (cs6, in this case), and zoomed in, the screen f

  • Auto-Run/Start Doesn't show up on iTunes

    Hi, I'm having a difficult problem about the Auto-Run/Start thingy for my iPod touch that doesn't show up on iTunes on my MacBook Pro 13". Just because I want to remove my pictures from my iPod touch so I can transfer into the MacBook Pro as Picture