Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

Timestampadd-Previousyear+Static date/Month

Received Response
31
Views
2
Comments
7688438
7688438 Rank 5 - Community Champion

Hi All, Ia m trying to add a filter to my report analysis date column. Date>='2019-07-01' and date <='2019=09-25'. Year should be calculated based on sysdate, I mean it should be sysdate-1. 07-01 & 09-25 are Static Values. Thank you, Raj

Answers

  • Hi,

    You are trying to add that filter, fine.

    And what did you try? What was the issue?

    Not sure Timestampadd is what you look for, it isn't really made for "fixed" dates logic but for logic based on a relative delta from a given date.

    In your case you can use the function to get the year from the current date (which is another function), do a -1 as it will be a number and you can do mathematical operations on it, cast it to a string and concatenate with the month-day fixed parts and cast to a date.

    The issue with timestampadd is that you would need to do all the logic to from the current date to your fixed dates, and it will not be any easier than the above logic.

    Try the formula in an analysis as formula in a column, you will have all the list of available functions by type in the window making it really easy to find and try.

  • 7688438
    7688438 Rank 5 - Community Champion

    I tried this.Below is the solution which worked for me.Thank you. CAST('25-JUL-'||CAST (YEAR (CURRENT_DATE)-1 AS CHAR) AS DATE)