Oracle Analytics Cloud and Server

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

How to compare today's date with last month's date in OBIEE

Received Response
894
Views
23
Comments
2

Answers

  • Rai Qaiser Hussain
    Rai Qaiser Hussain Rank 5 - Community Champion

    @Gianni Ceresa

    Yes you are right, If such exception raise then I shall return the zero amount.

    There are two phases of this requirement

    Phase 1, fullfil the above requirement

    Phase 2, Add exception for such scenarios

    I hope you will guide me for both phases

    regards

  • Teresa Modesta
    Teresa Modesta Rank 5 - Community Champion

    -  I have had clients insist in all seriousness on all months having 31 days!

    Maybe the next psychic requirement is a decimal month?!

    Those of you who are psychic - raise my hand?

  • Teresa Modesta
    Teresa Modesta Rank 5 - Community Champion

    If you want any help at all here then you need to clearly define your entire requirement before posting.

    And see my second suggestion, you could use a combination of a case statement to catch your stupid dates and filter to achieve exactly what you are after.

    And no I won't write it for you, and yes I do think you will have wasted your own time if you do - your requirement is just plain stupid.

  • Christian Berg-0racle
    Christian Berg-0racle Rank 10 - Analytics Guru
    Larry's Friday Girl wrote: - I have had clients insist in all seriousness on all months having 31 days!

    I've seen whole Data Warehouses designed like that. The DAGO, MAGO, YAGO keys were all filled so that the joins could pick up and/or aggregate data as needed. March 28, 29, 30, 31 all had as MAGO key the 28th of Feb for example.

    In terms of "sense" you can make of it what you want but for those clients it was he valid route to take.

  • Christian Berg-0racle
    Christian Berg-0racle Rank 10 - Analytics Guru
    Larry's Friday Girl wrote:If you want any help at all here then you need to clearly define your entire requirement before posting.

    And therein lies the problem. Clients can't be bothered to explain things themselves from the get-go - which is why the profession of the consultant exists who asks the right questions because he's

    a) a professional

    b) an expert

    Follow-up issue: most "consultants" nowadays are pretty much reduced to mindless drones; executing anything thrown in front of them without even wasting a single thought on the why and how of things.

    Combine 1 and 2 and you have the explanation for just about every project failure.

  • Teresa Modesta
    Teresa Modesta Rank 5 - Community Champion

    I stand by ridiculous - take 28 February, does it join to 31 March or 28th March or 28,29,30,31 March??

    What is anyone trying to achieve with this, comparing 'like' with 'like', if so you have already failed as March has 31 days - February usually 28, so you would have to abandon the month and have the standard month period. Maybe a rolling standard 30 days, so just go back 30 days as a standard month - it makes as much sense as March 31 not being comparable to anything...

  • Teresa Modesta
    Teresa Modesta Rank 5 - Community Champion

    Completely agree.

    I ask 'why' and 'what are you really trying to achieve here' more than is healthy for my career.

    Project managers too are often guilty of the same mind set of not challenging the poor requirement.

    I must change my display name back to the original, I keep getting called Larry and the apostrophe does not display properly!

  • Christian Berg-0racle
    Christian Berg-0racle Rank 10 - Analytics Guru
    Larry's Friday Girl wrote:I must change my display name back to the original, I keep getting called Larry  and the apostrophe does not display properly!

    I'd rather have an issue with being Larry's side-girl only for Fridays, no?

  • Rai Qaiser Hussain
    Rai Qaiser Hussain Rank 5 - Community Champion

    Hi All

    I am really thankful to all of you for suggestions

    in the most simplest way, my requirement is just to get result as below query

    SELECT TRUNC(SYSDATE), ADD_MONTHS(TRUNC(SYSDATE), -1) FROM DUAL;

  • Teresa Modesta
    Teresa Modesta Rank 5 - Community Champion

    So compare 1st February with 1st January

    ...

    Compare 28th February - when not a leap year - with 28 January? or 31 January?

    So compare May 31 with April 30? or ?????

    As I suggested before to break it down for you; -

    Use substring to scrape out the day number and the month text and then use these in case logic to derive the number of days to go back, to take into account the oddness as detailed above.

    Use the result of this in ago at day detail level to get you day X ago.

    Or, have a word with whoever is asking you for this, take this through the oddness of the logic and ask them if they are okay with it always looking 30 days back, as then it is always consistent and also easy for them to understand.