Oracle Transactional Business Intelligence

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

Filter for terminations in prior calendar week

81
Views
3
Comments

Summary

I'm creating a termination report and trying to show which terminations were in the calendar week (Sunday-Saturday) prior from the week when the report was run

Content

Hello,

I'm trying to create a report that shows which terminations were from the prior calendar week. So far I've only been able to create the below formula to show terms for 1 week prior to current date, but it's calculating the past 7 days, not calendar week. I've tried changing the formula to use CALENDAR WEEK but to no avail. 

CASE  WHEN (("Worker"."Termination Date" IN (timestampadd(SQL_TSI_WEEK,-1,CURRENT_DATE))) OR ("Worker"."Termination Date" IN (CURRENT_DATE))) THEN 'Last Week' ELSE '' END

I would like this to be a value in a column. So for example, if we ran the report today, Thursday September 21st, any employee whose termination date was between Sunday, Sept 10 and Saturday Sept 16 would have the value LAST WEEK, in the column. We would then be able to use that column as a table prompt to show terminations in the last week. We do not want it as a filter on the entire report, because we are using the same analysis criteria to also show terminations by mth and quarter. 

I've attached a screenshot of what we're trying to get to. 

Screen Shot 2017-09-21 at 2.36.26 PM.png

Comments

  • Nirmal-64675
    Nirmal-64675 Rank 2 - Community Beginner

    Hi Karen,

    Try the below formula, it will give you the expected result.

    CASE WHEN "Worker"."Termination Date"  BETWEEN timestampadd(SQL_TSI_DAY,(-6-(DAYOFWEEK(current_date))),CURRENT_DATE)  AND timestampadd(SQL_TSI_DAY,-(DAYOFWEEK(current_date)),CURRENT_DATE) THEN 'Last Week' END

    Let us know if this resolves your issue.

    Thanks
    Nirmal

    http://www.dataterrain.com

  • Karen B
    Karen B Rank 3 - Community Apprentice

    That worked! Thank you so much :)

  • Lavanya Reddy
    Lavanya Reddy Rank 1 - Community Starter

    Hi,

    could you please share the catalog. I have a similar requirement where I would like to know how to add the filter for getting records as of yesterday dynamically?