Sorting a hierarchy ...

Hi Everyone,
I have a table which is structured as a hierarchy thus ...
id parent
top -/-
GB top
London GB
Bristol GB
Manchester GB
DE top
Berlin DE
Munich DE
FR top
Paris FR
Lyon FR
... etc.
... which I need to output in the same format.
However the order of the items is completely random (in the table) so Berlin does not appear directly below DE (for example) ...
ES top
Moscow RU
Madrid ES
Edinbourgh GB
... etc.
So what I need is a sorting syntax which will retreive the table's contents as I have presented above (in the first extract) with the hierarchy displayed in its natural groups (i.e. DE followed by Berlin, Munich, etc.).
I have played around the the "PARTITION" command but cannot seem to get it working so am hoping that someone out there can point me towards the correct syntax?
Many thanks,
Alan Searle

Hi, Alan,
Use CONNECT BY:
SELECT     id
,     parent
FROM     table_x
START WITH     parent     IS NULL
CONNECT BY     parent     = PRIOR id
ORDER SIBLINGS BY     id          -- Optional
;ORDER SIBLINGS would guarantee that DE and FR (with all their cities) came before GB, and that, within each country, the cities appeared in alphabetic order, like this:
id          parent
top
DE           top
Berlin           DE
Munich           DE
FR           top
Lyon           FR
Paris           FR
GB           top
Bristol      GB
London           GB
Manchester      GB
...For an introduction to CONNECT BY queries, see
http://philip.greenspun.com/sql/trees
For several examples of CONNECT BY queries, see
http://www.java2s.com/Tutorial/Oracle/0040__Query-Select/HierarchicalQueries.htm
Naturally, CONNECT BY is documented in the SQL language manual:
http://docs.oracle.com/cd/B28359_01/server.111/b28286/queries003.htm#sthref3259
Edited by: Frank Kulash on Jan 2, 2012 5:59 AM

Similar Messages

  • Complete Sorting Criteria Hierarchy for songs/episodes/groups with Classic

    Ok, I have an idea that I think would help a lot of people. Let us begin a thread that tries to explain, in detail, the sorting filters, in order of priority, that the iPod Classic uses to sort its lists of albums, songs, tv episodes, etc., once you have a list in front of you on the screen. This goes for Cover Flow mode, regular listing, etc.
    Here is what I propose. For example, let's start with songs. In iTunes, when you choose to edit the info on a particular song, you can choose which fields to populate. You may or may not enter the year, the track number, the composer, etc. On your iPod, then, if you click on an Album, the songs you see within that album will be listed by +track number, as they were assigned in iTunes+. Track number takes highest precedence in the hierarchy when it comes to sorting songs within an album.
    - But, if you go Main Menu->Music->Albums, how are all the albums sorted? Alphabetically by album title? Alphabetically by artist? Is there a way to sort them by year? Would you like the freedom to choose, if Apple provided it?
    - How are the compilations sorted into the mix?
    - How does applying an "album artist" affect the sorting, as opposed to just applying an "artist?"
    - How do songs that are "grouped" together with the same "Grouping" field affect sort lists on the iPod?
    - In Cover Flow mode, now with firmware upgrade 1.0.2, what is the sort criteria for albums in Cover Flow? Alphabetically by album title? Alphabetically by artist of the first track on the compilation? Alphabetically by "album artist?" What if no "album artist" has been attributed to a "compilation?"
    - What about TV Episodes? Within a particular season, what is the primary determining factor for sorting episodes? Is it alphabetically by title? By release date? Or by episode #? Or by something else?
    To some, this may seem tedious or trivial. But there seem to be so many issues flying around right now, and many of them center squarely upon the inability to sync and sort properly. Many people are digitizing a cd library for the first time with the release of the 160 GB iPod Classic, and when you're trying to organize HUNDREDS of songs, albums, compilations, and tv episodes, understanding exactly how the iPod sorts all your precious data is crucial. Knowledge is power, and we want to know.
    ANY help you can contribute to any aspect of iPod sorting, no matter how obvious or how technical, would be appreciated by all.

    Ok, I have an idea that I think would help a lot of people. Let us begin a thread that tries to explain, in detail, the sorting filters, in order of priority, that the iPod Classic uses to sort its lists of albums, songs, tv episodes, etc., once you have a list in front of you on the screen. This goes for Cover Flow mode, regular listing, etc.
    Here is what I propose. For example, let's start with songs. In iTunes, when you choose to edit the info on a particular song, you can choose which fields to populate. You may or may not enter the year, the track number, the composer, etc. On your iPod, then, if you click on an Album, the songs you see within that album will be listed by +track number, as they were assigned in iTunes+. Track number takes highest precedence in the hierarchy when it comes to sorting songs within an album.
    - But, if you go Main Menu->Music->Albums, how are all the albums sorted? Alphabetically by album title? Alphabetically by artist? Is there a way to sort them by year? Would you like the freedom to choose, if Apple provided it?
    - How are the compilations sorted into the mix?
    - How does applying an "album artist" affect the sorting, as opposed to just applying an "artist?"
    - How do songs that are "grouped" together with the same "Grouping" field affect sort lists on the iPod?
    - In Cover Flow mode, now with firmware upgrade 1.0.2, what is the sort criteria for albums in Cover Flow? Alphabetically by album title? Alphabetically by artist of the first track on the compilation? Alphabetically by "album artist?" What if no "album artist" has been attributed to a "compilation?"
    - What about TV Episodes? Within a particular season, what is the primary determining factor for sorting episodes? Is it alphabetically by title? By release date? Or by episode #? Or by something else?
    To some, this may seem tedious or trivial. But there seem to be so many issues flying around right now, and many of them center squarely upon the inability to sync and sort properly. Many people are digitizing a cd library for the first time with the release of the 160 GB iPod Classic, and when you're trying to organize HUNDREDS of songs, albums, compilations, and tv episodes, understanding exactly how the iPod sorts all your precious data is crucial. Knowledge is power, and we want to know.
    ANY help you can contribute to any aspect of iPod sorting, no matter how obvious or how technical, would be appreciated by all.

  • How to sort a Hierarchy?

    Hi experts,
    I have uploaded a hierarchy(from flat file) to an InfoObject and I need to see it in alfabetical order.
    So, all nodes and final elements have to be ordered by his description not by his code.
    Anybody knows a way to do this??
    In RSA1, where I open the hierarchy, there is no option to order it.
    Thanks!
    regards

    there is a option of sorted heirarchy to sort ur field in alphabetical order.
    Check this link:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0403a990-0201-0010-38b3-e1fc442848cb
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/9b39e690-0201-0010-748d-cc62c5ecbb49

  • Sort of hierarchy elements

    It is possible to have a descending order applied to just one element of a hierarchy?
    How?
    e.g.. Suppose my hierarchy is
    year (2000,2001)
    month (1,2,3)
    Now, if I expand year and month nodes I have this:
    2000
    --1
    --2
    --3
    2001
    --1
    --2
    --3
    I would rather have this:
    2000
    --3
    --2
    --1
    2001
    --3
    --2
    --1
    Thanks
    Luc

    914898 wrote:
    It is possible to have a descending order applied to just one element of a hierarchy?
    How?
    e.g.. Suppose my hierarchy is
    year (2000,2001)
    month (1,2,3)
    Now, if I expand year and month nodes I have this:
    2000
    --1
    --2
    --3
    2001
    --1
    --2
    --3
    I would rather have this:
    2000
    --3
    --2
    --1
    2001
    --3
    --2
    --1
    Thanks
    LucIf by hierarchy you mean you are producing this output with a CONNECT BY statement then yes, you can use an order by SIBLINGS to achieve this.
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/queries003.htm#SQLRF52335
    Cheers,

  • Webi 4.0 Custom Sort for SSAS Hierarchy

    Hi,
    I'm using SSAS cube as a source for my webi report .Some report need custom sorting for hierarchy object , we are not able to apply sorting correctly in webi.
    What do i need to do in order to apply the custom sorting for hierarchy object?  Thanks.

    Hi, I've written a post on this:
    http://blog.davidg.com.au/2011/09/dynamic-measures-in-webi-on-any-data.html
    ...and a few people in the comments seemed to have the same problem as you, which seems to be a bug (clicking the ellipsis does not launch the custom values screen).
    Perhaps you could try the solution offered by Gallin, which was to create a second input control, then retry the steps to create another input control and click the ellipsis to enter custom values.
    Hope that helps.

  • Preserve the sorting of a hierarchy during import to MDM

    Hi experts
    I have imported a hierarchy from a legacy publishing system
    The file is XML and itu2019s close to perfect except for one very important thing
    The hierarch is sorted manually in the legacy system and not by any number or letters
    This sorting has to be preserved throughout the entire migration
    I know itu2019s possible to sort the hierarchy by hand in MDM by inserting a category as sibling.
    This is what I need to avoid for potentially over 300.000 categories in all in many hierarchies.
    Using the "create hierarchy filed" in the import manager, should display 4 fields instead of only 3
    The last filed should be used to sort the hierarchy during import.
    Iu2019m able to get a running number from the legacy to control the sorting of the categories.
    Hope you have a solution.
    Please do not tell me that I just have to live with one more missing function in MDM.

    Hi again
    Nobody had the same problem as me?

  • Sort Hierarchy Alphabetically

    How can I sort a hierarchy alphabetically? The hierarchy structure is extracted from 3rd party source system and the records in same level sorted according to nodename. In the reports I can sort alphabetically according to text but when I create a Bex variable to choose the hierarchy, the hierarchy structure in the selection screen is sorted according to nodename and I don't see any option to sort it alphabetically according to its medium description.

    Did you solved it?

  • Custom Sort for nodes in a hierarchy

    Hi All,
    I would like to know how to sort nodes according to a specific order in a hierarchy. I know at the hierarchy level you can set the StandardHierSort property to a custom property i.e CustSortOrder.
    But for the custom property CustSortOrder, how do i set it up so the nodes in the hierarchy will be sorted according to the custom list?
    Thanks
    R

    This is right out of the MDM_User_guide (Look under Custom Sort Order)
    Custom Sort Order
    Nodes can also be sorted in any explicit custom sort order (although limbs are always sorted
    ahead of leaves.) The sort order can be defined by any property that has a property data type of
    SortOrder. (The SortOrder data type is special case of an Integer data type.) By default, any
    Hyperion MDM installation includes a property called Sort Order (assigned to the Default
    property category) that can be used for this purpose.
    To sort a hierarchy according to the value of a node-level sort order property, the hierarchylevel
    property StandardHierSort must have its value set to point to the appropriate node-level
    property that contains the sort order.
    A custom sort order can also be used that applies only to a specific Hyperion MDM user ID,
    enabling users to customize their display of Hyperion MDM data without impacting other users
    of the same hierarchy. This is controlled by the hierarchy-level property UserHierSort. If this
    property has been set to point to a node-level property that has a data type of Sort Order, then
    this sort order takes precedence over both the StandardHierSort property and the default sort
    order.
    If there is no value assigned to the hierarchy-level property StandardHierSort nor to
    UserHierSort, then the default sort order is applied.
    The value of a custom sort order property can be set in any of the following ways:
    1.Sort order values can be loaded into a node-level sort order property when data is initially
    imported into Hyperion MDM (see following for details.)
    2. Explicit values can be defined for the sort order property for any node.
    If a sort order property has been selected for a hierarchy’s StandardHierSort or UserHierSort
    properties, then the Order Children menu option is available by right-clicking on any node
    in a hierarchy. This opens a dialog box that enables the sort order of limbs and leaves to be
    set graphically.
    3. A node-level sort order property might be defined as Derived, and so might be automatically
    populated with a sort order.

  • Sort Order issue when exporting from DRM

    The sort order hierarchy (Parent/Child) in DRM is correct, and appears in the right order. When the hierarchy gets exported, some of the nodes are out of order in HFM.
    There are shared nodes in the hierarchy. There is a Custom Sort order that is set correctly for the hierarchy in DRM.There is also a Query that was created to export nodes that does not contain the word Shared.
    Ex
    DRM
    Parent 1
    Child 2700
    Child 2701
    Appears in HFM
    Parent 1
    Child 2701
    Child 2700
    The sort order is not correct in Smartview. Why would the nodes show correctly in DRM, but export out of order, and not show correctly in HFM?
    Any suggestions or comments would be greatly appreciated.

    Can you evaluate the DRM export results with the Hiearchy structure, also make sure the Default Hierarchy Sort on the Hierarchy has a value assigned to it, whether it is core or custom based on node ID, DRM should export nodes as they appear in DRM.

  • Member sorting in FR

    In FR, when I set the member selection of a row dimension as "Descendants of XXX", the output will be member in level 0, and then level 1 and so on...
    is it possible to change the sorting so that members in higher level will be printed first?
    For example, the hierarchy of the "Customer" dimension is as follow:
    Customer
    |_Total Customer
    |_Customer A
    |_ Sub Cust A-1
    |_ Sub Cust A-2
    |_Custerom B
    |_ Sub Cust B-1
    |_ Sub Cust B-2
    |_ Sub Cust B-3
    when I set it to row dimesnion and set the member selection as "Descendants of Customer". the outout will be:
    Sub Cust A-1
    Sub Cust A-2
    Customer A
    Sub Cust B-1
    Sub Cust B-2
    Sub Cust B-3
    Customer B
    Total Customer
    However, I would like the output be printed as follow:
    Total Customer
    Customer A
    Sub Cust A-1
    Sub Cust A-2
    Customer B
    Sub Cust B-1
    Sub Cust B-2
    Sub Cust B-3
    How can I do?
    Thanks.

    Hmmm...I can't find a way to force outline sort order. I believe this has been an on-going issue with FR.
    Here is what I tried (v11.1.1.3 against Essbase):
    -Member selection sort options: hierarchy desc and asc (I think these are limited to only the view within member selection)
    -SortHierarchy function (although this is strictly for Web Analysis - thought I would try it anyways)
    -Various other functions not intended for this (which I tried to manipulate, but failed)
    -Grid sort set-up (this seems to be restricted to alphabetical sorts only)
    The closest I could come to this type of sort is through the expansion feature, and this assumes you only have a few levels you need to show on the report:
    -when the dimension is located in the rows
    -the grid expansion properties are set to "after parent"
    -member selection is set to member "Total Customer" and then @ichildren of "Total Customer", in separate rows
    -expansion is set on the @ichildren row member
    However, the expansion doesn't auto-expand, so users would have to run the report in HTML and then expand it themselves. They could then run and print it in PDF format.
    Hopefully someone out there knows of a better trick to getting this to work!
    -O

  • Report on hierarchy with different levels for key figures

    Within 1 BEx query report, is there a way to report on a hierarchy where one key figure is at level 6 and another key figure at level 5? Level 6 being the lowest leaf node. That is the key figure at the level 5 wouldn't have data at level 6 aggregated or summed up to level 5. Doesn't seem possible because how would the data be modeled in the IC but has this ever been done?

    This could be easily done at the query level. If you are using 7.x query designer drag the key fig you want at level 1 (top) first. Then drag the key figure you want at level 2 and drop on the level 1 key fig. Now drag and drop level 3 key fig on level 2 key fig. This way you can create a sort of hierarchy for key fig, but the lower level key figures would not be aggregated to the upper level key figures.
    If you use 3.x query designer, you have to use level up and level down options after right clicking on the key figure. Place all your key fig (all levels) in the columns. now right click on the level 2 key fig and choose level down option. right click on the level 3 key figure and choose level down twice.

  • Sort by selection

    Hi experts,
    in BEx 3.5 it was possible to sort characteristics ascending or descending dependant to their key or description.
    Since BEx 7 it is also possible to sort "by selection".
    Unfortunately I'm obviously a bit too dumb to understand that feature - and I didn't find any further documentation about it.
    Could you please bring some enlightment to me about that feature?

    Mh,
    what I'm talking about is:
    Start BEx Analyzer (Excel) open a report and open the properties for a characteristic.
    Check the entries of the drop-down-field for "sort by". There you'll find the item "selection".
    For a characteristic with a presentation-hierarchy enabled this sorting-option seems to make
    sense: It allow to sort the hierarchy-entries freely.
    But for a normal characteristic (~without an enabled hiearchy) there seems not to be a lot of sense
    in this feature. It seems as if one could place exactly one char-value to a free position within the value-list,
    but as soon as one tries to move another list-entry, the list is obviously resorted asc/desc first.
    And that's some kind curious to me - and the reason why I think that I didn't understand that feature yet.
    Kind regards,
    and thanks for your reply Karen!
    Marco

  • Quicksilver or Automator? Or something else? (Complicated task within)

    I have a big list of categories and names here: http://www.alecquighardworker.com/97-69.txt (1). Pretty much every separate line needs to be turned into a folder titled what’s on that line. (Ex: Folders for “Art” “TodPapageorge-Richard_BWoodward” “AnthonyMccall-Graham_Ellard_and_StephenJohnstone” and so on). Is there an automated way of doing this? Otherwise I’d be creating a bunch of folders and then copy and pasting endlessly.
    And, what would REALLY be cool is if I could automate so a process would go through this document and create the folders that follow some sort of hierarchy. Ideally, the folders would be like “Art” > “TodPapageorge-Richard_BWoodward”, “AnthonyMccall-Graham_Ellard_and_StephenJohnstone”, “JudithLinhares-Madison_SmarttBell”, “Literature” > “LynneTillman-GeoffreyOBrien”, “Poetry” > “Laurie_Sheck”, “Anne_Waldman”, “Donald_Platt” and so on. If those could all be under the folder “Fall2006,_No97” it might allow me to go through this entire huge document very quickly and relatively easily.
    What will ultimately happen with all of this data: There are already folders numbered 1-100, each containing folders for called “Art” “Literature” “Poetry” “Fiction” “Music” “Film” “Theatre” and so on. (Here's a pic of that heirarchy: http://www.alecquighardworker.com/Picture%201.png). All of the folders I create will have to be moved into those preexisting folders. That gets a little more tricky, so I don’t mind doing that manually. FYI, this is being done so a static website can be updated for the launch of a new, dynamic one.
    Unfortunately I’m only an intermediate QS user at best. However, if anyone has any ideas, or even other programs or places to look for general automation help, I would very much appreciate!
    Thank you!
    Alec
    1 This text has been prepped for folder naming and comes from the page here: http://www.bombsite.com/backissues.html.
    I cross-posted this here: http://blacktree.cocoaforge.com/forums/viewtopic.php?p=27749#27749
    powerbook g4 Mac OS X (10.4.6) 1.67ghz, 1GB RAM, superdrive

    I have a big list of categories and names here: http://www.alecquighardworker.com/97-69.txt (1). Pretty much every separate line needs to be turned into a folder titled what’s on that line. (Ex: Folders for “Art” “TodPapageorge-Richard_BWoodward” “AnthonyMccall-Graham_Ellard_and_StephenJohnstone” and so on). Is there an automated way of doing this? Otherwise I’d be creating a bunch of folders and then copy and pasting endlessly.
    And, what would REALLY be cool is if I could automate so a process would go through this document and create the folders that follow some sort of hierarchy. Ideally, the folders would be like “Art” > “TodPapageorge-Richard_BWoodward”, “AnthonyMccall-Graham_Ellard_and_StephenJohnstone”, “JudithLinhares-Madison_SmarttBell”, “Literature” > “LynneTillman-GeoffreyOBrien”, “Poetry” > “Laurie_Sheck”, “Anne_Waldman”, “Donald_Platt” and so on. If those could all be under the folder “Fall2006,_No97” it might allow me to go through this entire huge document very quickly and relatively easily.
    What will ultimately happen with all of this data: There are already folders numbered 1-100, each containing folders for called “Art” “Literature” “Poetry” “Fiction” “Music” “Film” “Theatre” and so on. (Here's a pic of that heirarchy: http://www.alecquighardworker.com/Picture%201.png). All of the folders I create will have to be moved into those preexisting folders. That gets a little more tricky, so I don’t mind doing that manually. FYI, this is being done so a static website can be updated for the launch of a new, dynamic one.
    Unfortunately I’m only an intermediate QS user at best. However, if anyone has any ideas, or even other programs or places to look for general automation help, I would very much appreciate!
    Thank you!
    Alec
    1 This text has been prepped for folder naming and comes from the page here: http://www.bombsite.com/backissues.html.
    I cross-posted this here: http://blacktree.cocoaforge.com/forums/viewtopic.php?p=27749#27749
    powerbook g4 Mac OS X (10.4.6) 1.67ghz, 1GB RAM, superdrive

  • Excel Pivot Table with Date Hierarchies - query performance degradation

    For the sake of this explanation, I’m going to try and keep it simple. Slicing the data by additional dimensions only makes the issue worse. I’ll keep this description to one fact table and three dimensions. Also, I’m fairly new to SSAS Tabular; I’ve worked
    with SSAS Multidimensional in the past.
    We’ve got a fact table that keeps track of bill pay payments made over time. Currently, we only have about six months of data, with the fact row count at just under 900,000 rows. The grain is daily.
    There is an Account dimension (approx. 460,000 rows), with details about the individual making a payment.
    There is a Payment Category dimension (approx.. 35,000 rows), which essentially groups various Payees into groups which we like to report on: Automobile Loan, Mortgage, Insurance, etc.
    There is the requisite Date dimension  (exactly 62093 rows-more days than we need?), which allows visibility as to what is being paid when.
    Using this DW model, I’ve created a SSAS BISM Tabular model, from which Excel 2010 is ultimately used to perform some analysis, using Pivot Tables. In the tabular model, for easier navigation (doing what I’ve always done in SSAS MultiDimensional), I’ve created
    several Date Hierarchies, Year-Month, Year-Quarter-Month, etc.
    There are currently only two measures defined in the Tabular model: one for the “Sum of PaymentAmount”; one for the “PaymentsProcessed”.
    OK, in Excel 2010, using a Pivot Table, drag the “Sum of PaymentAmount” measure to the Values section, next to/under the PivotTable Field List. Not too exciting, just the grand total of all Payments, for all time.
    Drag the “YearMonth” hierarchy (from the Date dimension) to the “Column Labels” section. After expanding the year hierarchy to see the months, now the totals are for each of the months, for which we have data, for June through November, 2013.
    Drag the “PaymentCategory” (from the Payment Categories dimension) to the “Report Filter” section. Filter accordingly: We just want to see the monthly totals for “Automobile Loans”.
    Now, some details. Drag the “AccountSK” (hiding the actual account numbers) to the “Row Labels” section. This shows all accounts that have made Automobile Loan payments over the last six months, showing the actual payment amounts.
    So far, so good. Remember, I’m using a Date Hierarchy here, in this case “YearMonth”
    Now, if any of the other attributes on the Account dimension table, say “CreditScore”, or “LongName”, are subsequently dragged over to the “Row Lables” section, under the “AccountSK”, the results will never come back, before timing out or by giving up and
    pressing ESCape!
    If this exact scenario is done by removing the Date Hierarchy, “YearMonth” from the “Column Labels” and replace it with “Year” and “MonthName” attributes from the Date dimension, these fields not being in any sort of hierarchy, adding an additional “Account”
    attribute does not cause any substantial delay.
    What I’m trying to find out is why is this happening? Is there anything I can do as a work around, other than what I’ve done by not using a Date Hierarchy? Is this a known issue with DAX and the query conversion to MDX? Something else?
    I’ve done a SQL Profiler trace, but I’m not sure at this point what it all means. In the MDX query there is a CrossJoin involved. There are also numerous VertiPaq Scans which seems to be going through each and every AccountSK in the Account dimension, not
    just the ones filtered, to get an additional attribute (About 3,600 accounts which are “Automobile Loan” payments.).
    Any thoughts?
    Thanks! Happy Holidays!
    AAO

    Thanks for your reply Marco. I've been reading your book, too, getting into Tabular.
    I've set up the Excel Pivot Table using either the Year/MonthName levels, or the YearMonth hierarchy and then adding the additional attribute for the CreditScore.
    Incidentally, when using the YearMonth hierarchy and adding the CreditScore, all is well, if the Year has not been "opened". When this is done, I suspect the same thing is going on.
    From SQL Profiler, each of the individual MDX queries below (formatted a bit for readability).
    Thanks!
    // MDX query using separate Year and MonthName levels, NO hierarchy.
    SELECT 
    NON EMPTY 
    Hierarchize(
    DrilldownMember(
    CrossJoin(
    {[Date].[Year].[All],[Date].[Year].[Year].AllMembers}, 
    {([Date].[MonthName].[All])}
    ,[Date].[Year].[Year].AllMembers, [Date].[MonthName]
    DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME 
    ON COLUMNS, 
    NON EMPTY 
    Hierarchize(
    DrilldownMember(
    CrossJoin(
    {[Accounts].[AccountSK].[All],[Accounts].[AccountSK].[AccountSK].AllMembers}, 
    {([Accounts].[CreditScore].[All])}
    ,[Accounts].[AccountSK].[AccountSK].AllMembers, [Accounts].[CreditScore]
    DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME 
    ON ROWS  
    FROM [PscuPrototype] 
    WHERE ([PaymentCategories].[PaymentCategory].&[Automobile Loan],[Measures].[Sum of PaymentAmount]) 
    CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS
    // MDX query using separate YearMonth hierarchy (Year, MonthName).
    SELECT 
    NON EMPTY 
    Hierarchize(
    DrilldownMember(
    {{DrilldownLevel({[Date].[YearMonth].[All]},,,INCLUDE_CALC_MEMBERS)}}, 
    {[Date].[YearMonth].[Year].&[2013]},,,INCLUDE_CALC_MEMBERS
    DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME 
    ON COLUMNS,
    NON EMPTY 
    Hierarchize(
    DrilldownMember(
    CrossJoin(
    {[Accounts].[AccountSK].[All],[Accounts].[AccountSK].[AccountSK].AllMembers}, 
    {([Accounts].[CreditScore].[All])}
    ,[Accounts].[AccountSK].[AccountSK].AllMembers, [Accounts].[CreditScore]
    DIMENSION PROPERTIES PARENT_UNIQUE_NAME,HIERARCHY_UNIQUE_NAME 
    ON ROWS  
    FROM [PscuPrototype] 
    WHERE ([PaymentCategories].[PaymentCategory].&[Automobile Loan],[Measures].[Sum of PaymentAmount]) 
    CELL PROPERTIES VALUE, FORMAT_STRING, LANGUAGE, BACK_COLOR, FORE_COLOR, FONT_FLAGS
    AAO

  • MTD/YTD reporting design, query designer

    Hi BI folks,
    I have a requirement to build queries through BEx query designer that show MTD and YTD figures.  I also have multiple versions/value type built into the RKFs already.  I am wondering if there is a way to display YTD/MTD figures, without having to physically restrict them into the RKFs??, (i.e. I would like to have that time restriction sitting on top of the structure as a characteristic).
    I am trying to create more flexibility for the end-user, rather that having a huge amount of selections in the structure representing a particular version and time period.
    Is there some sort of hierarchy or variable definition that anyone can suggest where I can solve this need?
    Thanks.
    - BJ

    BJ,
    this depends on the environment that you are using, but it is fairly simple to do for MTD and YTD.
    as there are multiple variables available to be used for this, I consistently use two in the restriction (but you can play around and see what fits your needs the most).  For each structure, you should restrict on the following:
    MTD:
    Period Characteristic - Restrict to variable 0P_PER3
    Fiscal Year Characteristic - Restrict to variable 0P_FYEAR
    QTD:
    Period Characteristic - Restrict to Value range from period 00 to variable 0P_PER3
    Fiscal Year Characteristic - Restrict to variable 0P_FYEAR
    The reason you should have the Fiscal Year there is that you can use the text variable to set the column headers.
    Be careful that you use the right KF for this.  You need the periodic activity for the KF.  The reason Period 00 is included as that is where the balance from the prior year is carried over, so if you want to have the YTD values for the Balance Sheet, you would want to include that.  This scenario is the only option in BCS, and it doesn't have the Cumulative values.
    you can also use the cumulative values, but that depends on how the KF's are set up
    Pavel

Maybe you are looking for