Skip to Main Content

Analytics Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Previous Month's Data

632089Apr 3 2008 — edited Apr 4 2008
I need to run my data daily pulling every day of the current month. The function I'm using for that is:

Calendar_Period_D.Month_No = TO_CHAR( SYSDATE, 'yyyymm')

This works fine, right up until the 1st day of the next month. Example, on April 1st, I'd need to pull all of March's data, but my current date function will return nothing since our data is always 1 day behind. And, if the 1st falls on a weekend and let's say the first Monday is the 3rd....I'd have to account for that as well and go back 3 days to get any valid data from Friday. Since Brio doesn't like "IF" statements on the limit line, I'm having a problem. We've been brainstorming with CASE WHEN statements in the Custom SQL box, but no luck yet.

The fields I have available are:
Day_Dt (date mm/dd/yy)
Month_No (month yyyymm)
Cal_Month_Start_Dt (always 1st of the month - this is an "um-duh" field but if it'll help...mm/dd/yy)
Week_Day_Ind (Y/N - this may be helpful to rule out weekends)
Current_Day_Ind (Y/N)
Prior_Process_Days_Qty (1 to XXXX. This counts back from today 1 = yesterday, 2= the day before, etc. Beauty of this field is it does not count weekends. If I can somehow relate this field to sysdate or any other date, I may be able to get past the weekend thing if the 1st weekday falls on Monday.)
Cal_Month_Last_Weekday_Dt (mm/dd/yy - this is the last weekday/working day of each calendar month).
Cal_Month_End_Dt (last day of month mm/dd/yy) We were trying to use this function to say something like "if Sysdate-1 = Cal_Month_End_Dt.....then Calendar_Period_D.Month_No = TO_CHAR( ADD_MONTHS ( SYSDATE, -1 ),'yyyymm')" but not sure how to write something like that and keep my initial current month code intact.

Any help would be great! Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 2 2008
Added on Apr 3 2008
1 comment
1,239 views