Cognos Analytics

Cognos Analytics

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


#Product
#Analytics
#CognosAnalytics
#Analyticstools
#TechXchange Partner
#TechXchange Session
#TechXchange Presenter
#AI
 View Only
  • 1.  Grouping

    Posted 07/16/20 10:43 AM
    Hi,

    I used a CASE statement in a calculated field 'ComparePeriod' to create 2 periods, something like this:-

    CASE 
    WHEN Date_Field between 'yyyymmdd' and 'yyyymmdd' THEN 'Period1'
    WHEN Date_Field between 'yyyymmdd' and 'yyyymmdd' THEN 'Period2'
    ELSE 0 END

    I want to Group on 'ComparePeriod' only - Problem is, I am unable to Group By 'ComparePeriod' without having to Group By the Date_Field too! 

    How can I Group By only on the 'ComparePeriod' ?





    ------------------------------
    Glen Miller
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: Grouping

    Posted 07/16/20 12:14 PM
      |   view attached

    Hi Glen,
    Assuming that you're using Reporting
    Did you remove the Date_Field from the report layout element.
    Attached is a small report spec, which generates:
    SELECT
        CASE
            WHEN ORDER_HEADER0.ORDER_DATE BETWEEN DATE '2004-01-01' AND (2004 - 12) - 31 THEN 'period1'
            ELSE 'period2'
        END AS Data_Item1
    FROM
        gosales_8_2.gosales_8_2.gosl.ORDER_HEADER ORDER_HEADER0
    GROUP BY
        CASE
            WHEN ORDER_HEADER0.ORDER_DATE BETWEEN DATE '2004-01-01' AND (2004 - 12) - 31 THEN 'period1'
            ELSE 'period2'
        END


    // Henk



    ------------------------------
    HENK CAZEMIER
    ------------------------------

    Attachment(s)

    xml
    Grouping on case stmt.xml   3 KB 1 version