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.  Cognos Dashboard - Fields type casting

    Posted 03/19/21 12:25 PM
    Hi,

    I am trying to solve a numeric overflow issue on the Cognos Dashboard. 

    On the Cognos Report authoring we have options to update the query items to have type casting before the Aggregation applied.. 
    Example - FIELD1 changed to "CAST(FIELD1 as DECIMAL (15,3))". And then these type cast applied before the field aggregation/Sum done. 

    SELECT FIELD0,
    SUM(CAST(FIELD1 AS DECIMAL(15, 3)))
    FROM TABLE1
    GROUP BY  FIELD0

    Cognos Dashbaord I have created a calculation for FIELD1_CALC as "CAST(FIELD1 as DECIMAL (15,3))". The SQL generated for the Dashboard chart as below.
    SELECT FIELD0,
    CAST (SUM(FIELD1) AS DECIMAL (15,3))
    FROM TABLE1
    GROUP BY  FIELD0. 

    This causing the numeric overflow on SQL execution and query getting failed.

    Can you please let us know if there are any way we can have the CAST done before the SUM?

    ------------------------------
    Chandrashekhara Kundadka
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: Cognos Dashboard - Fields type casting

    Posted 03/23/21 12:49 AM
    Hi All,
    Any help really appreciated!
    Regards
    Chandra

    ------------------------------
    Chandrashekhara Kundadka
    ------------------------------



  • 3.  RE: Cognos Dashboard - Fields type casting

    Posted 03/24/21 03:33 AM
    Hi Chandra, 

    Did you try total(CAST(FIELD1 as DECIMAL (15,3))) in the expression instead?

    Also, what is the Aggregate for FIELD1? If you are not using it anywhere else, then try setting it to None and the above expression. 

    If you are getting CAST(sum(FIELD1) as DECIMAL (15,3)) in the query, it means the aggregate of FIELD1 is being applied. 

    Regards



    ------------------------------
    Kiran Passumarthi
    www.linkedin.com/in/kiranpassumarthi
    ------------------------------



  • 4.  RE: Cognos Dashboard - Fields type casting

    Posted 03/24/21 06:06 AM
    Hi Kiran,
    Thank you so much for your help..!! I see on dashboard changing expression to total(CAST(FIELD1 as DECIMAL (15,3))) worked!! 

    For the FIELD1 Aggregation defined is "sum" in Framework manager. 

    By adding Total() on the expression, on dashboard it now force CAST applied before SUM!!

    Thanks again for your suggestion. 


    ------------------------------
    Chandrashekhara Kundadka
    ------------------------------