Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Help with Business Objects formula

Posted on 2013-11-21
19
Medium Priority
?
807 Views
Last Modified: 2013-12-30
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.
0
Comment
Question by:rfedorov
  • 10
  • 9
19 Comments
 
LVL 49

Expert Comment

by:PortletPaul
ID: 39667955
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

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
0
 

Author Comment

by:rfedorov
ID: 39669110
thank you very much, i also have 10 holidays, how to implement them
?
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 39670721
>>" i also have 10 holidays, how to implement them"

as a table
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:rfedorov
ID: 39674898
Thank you, but how to make a table in Business Objects?
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 39676338
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)
0
 

Author Comment

by:rfedorov
ID: 39677816
thank you for clarification, I am referring to Business Objects as Webi
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 39679336
If you must include holidays into the calculation I don't think you have any alternative, you have to place the holidays into a table in a database.

You still haven't identified the database type (vendor) so we can propose the correct sql query syntax
0
 

Author Comment

by:rfedorov
ID: 39679353
I am referring to Business Objects as Webi
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 39679468
I am referring to the database underneath

e.g. Oracle, MS SQL Server, Sybase, DB2,MySQL, Postgres ....
0
 

Author Comment

by:rfedorov
ID: 39679484
I have no idea, what i know I am using Business Objects Webi front end
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 39679520
Then if you have no idea you will have dreadful trouble trying to get the syntax correct.

Q1: Are you able to find other queries that do any of these things?

concatenate 2 strings
replace a null with some other value
perform some date arithmetic

if we can see any of these we can make a judgement about the dbms vendor

----
Q2: Do you know if you directly accessing the underlying database or using a provided Universe?
0
 

Author Comment

by:rfedorov
ID: 39680978
Q1. I can do all of those
Q2. I am quering thru provided Universe.
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 39682483
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?
0
 

Author Comment

by:rfedorov
ID: 39687070
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 !
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 39687700
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.
0
 

Author Comment

by:rfedorov
ID: 39702251
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...
0
 
LVL 49

Expert Comment

by:PortletPaul
ID: 39702285
Have you tried the case expression I supplied? http:#a39667955
0
 

Author Comment

by:rfedorov
ID: 39702300
yes, I did
it did not work
0
 
LVL 49

Accepted Solution

by:
PortletPaul earned 1500 total points
ID: 39705192
by "did not work", do you mean:

it caused an error
- or -
it did not produce the expected result

If it caused an error what was the error message please.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Jaspersoft Studio is a plugin for Eclipse that lets you create reports from a datasource.  In this article, we'll go over creating a report from a default template and setting up a datasource that connects to your database.
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question