Categories
- All Categories
- 4 Oracle Analytics Videos
- 13.7K Oracle Analytics Forums
- 5.1K Oracle Analytics Idea Labs
- Oracle Analytics User Groups
- 57 Oracle Analytics News
- 31 Oracle Analytics Trainings
- 53 Oracle Analytics Data Visualizations
- 2 Oracle Analytics Career
- 2 Oracle Analytics Industry
- Find Partners
- For Partners
We're thrilled to have you join our community of analytics enthusiasts and professionals. To enhance your experience and foster meaningful interactions, we encourage you to personalize your profile by setting up a display name and uploading a profile picture. Your display name will be how others recognize and engage with you in discussions, while a profile picture adds a personal touch to your forum presence.
Take a moment to update your profile with a display name and an image representing you. Let's create a vibrant and engaging community together!
Is it possible to exclude Weekends for Days open calculation in BI reporting?
Summary:
Is it possible to exclude Weekends for Days open calculation in BI reporting?
Content (required):
Hi,
We have a requirement to identify the Requisitions which are posted internally for 7 Business days (Excluding weekends and Holidays). Is there a way to calculate Business days alone using SQL query? I know the holidays can be identified using calendar tables, but we are stuck with finding ways to exclude weekends in our query.
Version (include the version you are using, if applicable):
Code Snippet (add any code snippets that support your topic, if applicable):
Answers
-
Hi
Below query snippet will help to identify the days excluding weekends.
D_DAY is the time dimension at day level.
You need to pass requisition creation date as 1-Jan-2022 and requisition end date as 15-Jan-22 in the query as commented below to calculate requisition posted days. You need to replace them with actual db column during the calculation logic.
This query assume the weekend is on SAT and SUN.
SELECT COUNT(DAY_DT) -- REQUISITION_POSTED_DAYS
FROM D_DAY
WHERE DAY_DT BETWEEN '01-JAN-2022' --REQUISITION_CREATE_DT
AND '15-JAN-2022' --REQUISITION_END_DT
AND TO_CHAR(DAY_DT,'DY', 'NLS_DATE_LANGUAGE = AMERICAN') NOT IN ('SAT','SUN')
Regards
Venkat
0 -
Hi Venkata,
D_DAY is invalid table and im getting error when i run this query. Is this query working for you?
Thanks,
Abhishek.
0 -
Hi Abhishek
You need to replace the D_DAY with your actual time dimension table. This table is given for reference purpose.
If you are using FAW, then I think the table is W_DAY_D. Pls give a try
Regards
Venkat
0 -
Hi @Abhishek Jois,
This can be handled if you have a proper calendar dimension associated with your data model. Most calendar dimensions will have a column CAL_DAY_OF_WK, which correspond to the numerical day of the week. You could either extend your calendar dimension to include a weekday flag by generating a logical column where CAL_DAY_OF_WK NOT IN (7,1) or use a filter in your reporting layer with the same logic.
0