Categories
- All Categories
 - Oracle Analytics Learning Hub
 - 19 Oracle Analytics Sharing Center
 - 17 Oracle Analytics Lounge
 - 233 Oracle Analytics News
 - 44 Oracle Analytics Videos
 - 15.9K Oracle Analytics Forums
 - 6.2K Oracle Analytics Idea Labs
 - Oracle Analytics User Groups
 - 87 Oracle Analytics Trainings
 - 15 Oracle Analytics Data Visualizations Challenge
 - Find Partners
 - For Partners
 
Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture
current_date auto change when it's Monday
                
                    PJ CHEN                
                
                     Rank 1 - Community Starter                
            
                        
            hi all,
I have a question about how to change the current_date,
I used CURRENT_DATE-2 to get the data,
however, I wounder can it auto update to CURRENT_DATE-4 when it's Monday
for example, in R , I will try like this :
if(weekdays.Date(Sys.Date())=="Monday"){
datadate <-Sys.Date()-4}else(datadate <-format(Sys.Date()-2)
Many thanks!!

0  
            Answers
- 
            
Hi,
you have a case statement in OBIEE
you also have a DayOfWeek function.
OBIEE: Calendar Date/Time Functions IN OBIEE
So, not hard to do the equivalent.
0 - 
            
You'll need something like this:
CASE WHEN DAYOFWEEK(CURRENT_DATE) = 2 THEN TIMESTAMPADD(SQL_TSI_DAY, -4, CURRENT_DATE) ELSE TIMESTAMPADD(SQL_TSI_DAY, -2, CURRENT_DATE) END
0 - 
            
THANKS YOU SO MUCH!!!
0 - 
            
THANKS!
0 
