I need a function like =NETWORKDAYS(start_date ,end_date, range of holidays to exclude )from Excel.
Definition: Returns the number of whole working days between start_date and
end_date. Working days exclude weekends and any dates identified in
holidays. Use NETWORKDAYS to calculate employee benefits that accrue based
on the number of days worked during a specific term.
Productivity AppsDB Reporting ToolsSQL
Last Comment
PortletPaul
8/22/2022 - Mon
PortletPaul
Not sure how you want to implement this, inside an SQL query?, or as a Crystal formula?
If you need to exclude holidays you will need a table of those dates.
If SQL the then syntax will depend on the dbms vendor. e.g. For SQL Server without regard to holidays it would be, but this would not work as-is in Oracle:
SELECT ID, (DATEDIFF(dd, StartDate, EndDate) + 1) -(DATEDIFF(wk, StartDate, EndDate) * 2) -(CASE WHEN DATENAME(dw, StartDate) = 'Sunday' THEN 1 ELSE 0 END) -(CASE WHEN DATENAME(dw, EndDate) = 'Saturday' THEN 1 ELSE 0 END) as working_days, <<other fierlds >>from your_table
Thank you, but how to make a table in Business Objects?
PortletPaul
I have no idea, I was referring to a table in the database.
If you look back at Ken Hamady's formula you will see it is using database table for holidays.
By the way. when you use the term Business Objects are you talking about Crystal? or Webi? or something else?
(If it's Crystal then I can add that topic to this question for you)
Roman F
ASKER
thank you for clarification, I am referring to Business Objects as Webi
Q1: I was after some code snippets to look at ("if we can see any of these")
If you only have access to a Universe does that mean you cannot create tables?
Roman F
ASKER
Are you serious? Why should I use Universe otherwise? You did not read the question. The question was how to create the formula (variable) in business object !
PortletPaul
I did read the question, and I know you asked for just a formula. I gave you one for use in SQL Server and a reference to formulas for use in Crystal Reports (also part of Business Objects).
But you need more than a formula, you also need a table to hold information about the holidays. Perhaps this exists already?
If you don't have permission to create a table you will have a lot of trouble allowing for holidays.
& I'm not sure how to help further unless you can identify the database type.
Thank you, but again, I have no access to "database", so I do not know what to say. I understand that is not possible to create formula because i can not create Holiday table...
PortletPaul
Have you tried the case expression I supplied? http:#a39667955
If you need to exclude holidays you will need a table of those dates.
If SQL the then syntax will depend on the dbms vendor. e.g. For SQL Server without regard to holidays it would be, but this would not work as-is in Oracle:
Open in new window
For Crystal formulas on this topic look no further than Ken Hamady's formulas:The number of "Work Days" between two dates:
If you need inspiration on calendar tables try this article by Jim Horn:
Date Fun, Part One: Build your own SQL calendar table to perform complex date expressions