Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

datediff counting week days 1

Status
Not open for further replies.
Jun 23, 2008
55
0
0
GB
I have a report that needs to count the number of working days between two dates, in crystal I use the following formula to count just working days:

=DateDiff ("ww", Fields!DateStart.Value, Fields DateEntered.Value, crMonday) +
DateDiff ("ww", Fields!DateStart.Value, Fields!DateEntered.Value, crTuesday) +
DateDiff ("ww", Fields!DateStart.Value, Fields!DateEntered.Value, crWednesday) +
DateDiff ("ww", Fields!DateStart.Value, Fields!DateEntered.Value, crThursday) +
DateDiff ("ww", Fields!DateStart.Value, Fields!DateEntered.Value, crFriday)

I have changed the field references to fit with SSRS and added the = but I think there must be something else I need to change (from Crystal format) for it to work.

When I go to run the report it tells me crMonday is not declared.

Can someone tell me how to do this in SSRS please?

Thanks in advance
Annie
 
well crMonday looks like it is a contant that is used within Crystal. I know that in MS Excel, the constants are vbMonday, vbTuesday etc etc so would give that a whirl

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Bingo, that works, I still get a red error line under vbMonday (just Monday not the others) in the expression showing as Unrecognized Indentifier, should I be worried about that? It seems to work regardless, it doesn't stop the report running and it's counting correctly.

Many thanks again

regards
Annie :eek:)
 
Hover over the redline and right-click on it. See what it says. If it works, I'd suppose it's fine. Thanks Geoff for the information. I never knew that!
~Brett

--------------------------
Web/.net Programmer & DBA
Central PA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top