Cognos Analytics

Cognos Analytics

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

 View Only
  • 1.  Scheduling the report for prior month

    Posted Tue September 13, 2022 11:06 AM
    Hi,
    I have a report scheduled daily for the current month's data.
    the logic for the current month is, that I have put a default selection as the "Current Month" and put a schedule thing using properties.

    if(?Year Month?='Current Month')
    then
    (
    [Date]<=[YYYY-MM]
    )
    else
    (
    [Date]<=?Year Month?

    [YYYY-MM] data item consist of "convert(varchar(7), current_date, 126)" (which is 2022-09)

    As of now, the new req is: on every first of the month the report should schedule and run for the prior month, and for the remaining days it should be for 'Current Month'
    for the preceding month do I need to develop similar to this or can we do anything while scheduling?
    if we need a logic change what might it be?

    Thanks,
    PS

    ------------------------------
    P S
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: Scheduling the report for prior month

    Posted Tue September 13, 2022 11:22 AM
    Hi PS,
    if it's only needed for the first day of the month, why not moving "current date" one day behind?
    Rewrite your YYYY-MM item to

     "convert(varchar(7), current_date-1, 126)
    On each first day of the month this calculation will convert the last day of the prior month and us it as filter and the rest of the month it will be the prior day of the current month. This will only work if the schedule runs exactly on the first day of each month.

    Does this fit your needs?

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



  • 3.  RE: Scheduling the report for prior month

    Posted Wed September 14, 2022 10:56 AM
    Hi Robert,
    Thanks for the reply.
    I' am also thinking the same logic: one day behind(current_date-1),

    but req is for the first of the month I need to schedule for the prior month(2022-08) and for the remaining days from the 2nd to 31st need to be scheduled for the current month(2022-09).

    ------------------------------
    P S
    ------------------------------



  • 4.  RE: Scheduling the report for prior month

    Posted Thu September 15, 2022 03:33 AM
    Edited by System Admin Fri January 20, 2023 04:12 PM
    Ok - you might need to check the syntax etc. but you probably need something along the lines of this in your filter:

    Current_date = first_of_month(current_date) and [YourDateField] between first_of_month(_add_month(current_date,-1)) and last_of_month(_add_month(current_date,-1))
    or
    current_date<> first_of_month(current_date) and [YourDateField] between first_of_month(current_date) and current_date


    ------------------------------
    Chris Turner
    ------------------------------



  • 5.  RE: Scheduling the report for prior month

    Posted Thu September 15, 2022 08:43 AM
    Hi Chris,
    Thanks for the logic.

    I think it will work, let me develop logic accordingly.


    ------------------------------
    P S
    ------------------------------