Cognos Analytics

Cognos Analytics

Connect, learn, and share with thousands of IBM Cognos Analytics users! 

 View Only
Expand all | Collapse all

selecting multiple members from cube to detail filter

  • 1.  selecting multiple members from cube to detail filter

    Posted Tue December 07, 2021 09:39 AM
    Hi,
    I have a challenge with one of the DQM reports,
    My report is using a cube as the source and has static choices like A, B, C, D .

    if the user selects 'A' 
    then report should produce data for only parent members

    if the user selects 'B'
    then  report should produce data for only child members

    if the user selects 'C'
    then report should produce data for some parents and children's from the hierarchy 

    can someone suggest to me how to implement this in detail filter using a case statement? 

    Thanks in advance.

    ------------------------------
    p sripadh
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: selecting multiple members from cube to detail filter

    Posted Wed December 08, 2021 03:11 AM
    My recommendation: create 3 crosstabs set up as A,B,C and a variable with condition A,B,C that would only display 1 of those crosstabs depending on your choice of ABC. Don't use filters with dimensional sources.

    Christian

    ------------------------------
    Christian Seiser
    ------------------------------



  • 3.  RE: selecting multiple members from cube to detail filter

    Posted Wed December 08, 2021 03:30 AM
    Thanks, Christian Seiser for your reply 
    but my req is  to select multiple cube members,
    if the user selects 'A' some parents and children from the hierarchy 
    if the user selects 'B' only parents 
    similarly for 'C' and 'D'

    I am facing an issue in selecting those members for the report

    Eg: a single data item should consist of multiple members( parents + children or only parents or only children ) from the hierarchy
    that I can use that for a filter condition 
    hope you understood my req

    ------------------------------
    p sripadh
    ------------------------------



  • 4.  RE: selecting multiple members from cube to detail filter

    Posted Wed December 08, 2021 03:36 AM
    Still my recommendation is to create 1 crosstab/list for each scenario, and use the render variable to display the right one. You don't use if-then-else with a dimensional source like you would with a relational source.

    ------------------------------
    Christian Seiser
    ------------------------------



  • 5.  RE: selecting multiple members from cube to detail filter

    Posted Wed December 08, 2021 03:53 AM
    If the user selects "Banking finance" then highlighted in yellow color companies should be selected in the report 
    please tell me how to achieve it
    Highlighted should be selected for static choices


    ------------------------------
    p sripadh
    ------------------------------



  • 6.  RE: selecting multiple members from cube to detail filter

    Posted Wed December 08, 2021 05:21 AM

    Hi,

    we also use static choices with dimensional data sources. The key is to write the multidimensional member set expression into the "Use:" field. Then add a query item that gets the choice from the parameter with a prompt macro.
    In my exmaple I used GO cube and Choice A is:
    set([great_outdoors_sales_en].[Retailers].[Retailers].[Retailer type]->:[PC].[@MEMBER].[2];[great_outdoors_sales_en].[Retailers].[Retailers].[Retailer]->:[PC].[@MEMBER].[1293],[great_outdoors_sales_en].[Retailers].[Retailers].[Retailer]->:[PC].[@MEMBER].[1123],[great_outdoors_sales_en].[Retailers].[Retailers].[Retailer]->:[PC].[@MEMBER].[1474];[great_outdoors_sales_en].[Retailers].[Retailers].[Retailer site]->:[PC].[@MEMBER].[5828])

    The expression for the data item in the rows is:

    Depending on your report you have to specify a default value or not. Keep in mind that the dimensional set expression must be valid. I reccomend to try each one of them in asingle data item before adding them to the static value prompt box. I used this approach in a few reports with set, union and except function



    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ
    Ingelfingen
    ------------------------------



  • 7.  RE: selecting multiple members from cube to detail filter

    Posted Wed December 08, 2021 06:07 AM
    Hi Robert,
    thanks for the solution.

    can you please specify what is 'Retailers';'token'; in the expression definition
    and using set members in the query can we write a case statement in detail filter for static choices which are defined on the prompt page 
    how to achieve it

    ------------------------------
    p sripadh
    ------------------------------



  • 8.  RE: selecting multiple members from cube to detail filter

    Posted Wed December 08, 2021 06:29 AM
    Hi,

    you can look up the definition of the prompt macro online or in the query expression editor of Report Studio
    https://www.ibm.com/docs/en/cognos-analytics/11.1.0?topic=macros-syntax

    As you can see 'Retailers' is the name of the prompt parameter I've created to send the selected static choice to the query calculation.


    'Token' then is the datatype. You can also use string, integer or memberuniquename - depending on what you want to have as prompt value. Usually 'token' does it.

    I have no knowledge what you want to achieve with those selected members from the hierarchy. If they should just filter a query, I sugguest do add a query calculation to your query which holds the prompt macro and thann add this to the slicer field (instead of using detail filters). Depending on the choice the user made you have individual filtered values from your query for your data containers. Each static choice has to be a member set expresion built with set, union, except, filter or any other combinatiom of dimensional member set expressions. This expression then returns the members and used as slicer, it reduces the values of the query to those members.


    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ
    Ingelfingen
    ------------------------------



  • 9.  RE: selecting multiple members from cube to detail filter

    Posted Wed December 08, 2021 07:07 AM
    Hi,
    My achievement is to filter the report based on the static choices 
    but for different choices, there will be different selections from that hierarchy

    ------------------------------
    p sripadh
    ------------------------------



  • 10.  RE: selecting multiple members from cube to detail filter

    Posted Wed December 08, 2021 10:40 AM
    If you want these selections just as filter: add the query calculation to the slicer area. Should they appear in the report? Drag them into the corresponding data container. I don't see any need for detail filters right now.

    The only difference in detail filter to slicer is that detail filters reduce the returned members whilst slicer only reduce the values returned.

    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ
    Ingelfingen
    ------------------------------



  • 11.  RE: selecting multiple members from cube to detail filter

    Posted Thu December 09, 2021 06:52 AM
    Hi Robert,
    Just I need to do those selections in the filter,
    I' am new to dimensional modeling can you please help me how to do it exactly 
    I created a set of companies for different options like A,B,C,D 
    Now I'am facing those static choices to call in filter level 
    help me how to ahieve it

    Thanks

    ------------------------------
    p sripadh
    ------------------------------



  • 12.  RE: selecting multiple members from cube to detail filter

    Posted Thu December 09, 2021 08:37 AM
    Edited by System Admin Fri January 20, 2023 04:10 PM
    Hi,
    as I wrote before: I don't get to the point why you need those selections as detail filters. A slicer is more or less also a "filter" in a dimensional model.
    To summarize my approach:
    • pre-defined member set expressions in a static value prompt, linked to a parameter
    • query calculation in the query which loads the selected choice from the parameter
    • Add the query calculation to the slicer field
      Done. This filters the values from your dimensional query by the pre-defined selections from the dropdown-box.
    Hope this clarifies the solution.

    If not: another approach would be to use A, B C etc. as values for the static choices and then use a case statement in your query calculation to point to other pre-defined sets in qour query like

    CASE Parameter 1
    WHEN 'A' THEN [set-expression 1]
    WHEN 'B' THEN [set-expression 2]
    ELSE  ...
    END

    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ
    Ingelfingen
    ------------------------------



  • 13.  RE: selecting multiple members from cube to detail filter

    Posted Thu December 09, 2021 12:04 PM
    Hi Robert,
    Thanks for the solution
    I tried 1st Method,
    different sets for static choices A,B,C,D, It's working fine but if I choose option A or B or C or D getting the same data in the report.
    is there anything that need to change,I followed the same as you specified.

    Thanks.

    ------------------------------
    p sripadh
    ------------------------------



  • 14.  RE: selecting multiple members from cube to detail filter

    Posted Fri December 10, 2021 03:22 AM
      |   view attached
    Attached you'll find a sample report based on IBMs "old" PowerCubes sample data. This is one of my approcahes I use in other reports.

    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ
    Ingelfingen
    ------------------------------

    Attachment(s)

    xml
    report.xml   8 KB 1 version


  • 15.  RE: selecting multiple members from cube to detail filter

    Posted Fri December 10, 2021 06:18 AM
    Hi Robert,

    As per my req user has to do selection in the prompt page,
    based on those static choices I need to filter the company data on the report level .
    Your approach works here?
    Thanks

    ------------------------------
    p sripadh
    ------------------------------



  • 16.  RE: selecting multiple members from cube to detail filter

    Posted Fri December 10, 2021 07:07 AM
    Edited by System Admin Fri January 20, 2023 04:28 PM
    Hi,

    if you want to filter the data values my approach works fine. The user selects a static choice which is a member set espression. This expression is then transfered as slicer to the query and filters the data to those members values. You can try this out with the sample report.

    Additional detail filters based on measures may be required to also limit the returned members for the data in your report. Slicers only reduce the returned values, not the members. E.G. If you have a detail filter like [YEAR]='2021' and the whole level YEAR is also in your data container (crosstab, list, chart), only 2021 will be shown. If you put 2021 in your slicer in the same report, all years will be visible but only 2021 will have values. Could you follow me?

    Sample report with detail filter:
    Sample report with slicer:


    ------------------------------
    Robert Dostal
    Team Leader BI
    GEMÜ
    Ingelfingen
    ------------------------------