Change the definition of a 'Week'? - crystal-reports

I'm generating an overtime report, and while Crystal Reports can group an employee's shifts into weeks, it uses a standard Sunday-Saturday week; I need a Monday-Sunday week(ie, Sept 12-18th inclusive). Is there any way to change this setting, or am I stuck with writing a complex formula?

I don't know of a setting that will allow you to do this, but the group formula is not too bad. The following will give you the week number/index in the year using Mondays as the start of the week.
datepart("ww",{table.date},crMonday)
You will probably want to incorporate the year, too. You can ensure proper sorting by year and week with this
totext(datepart("yyyy",{Orders.Order Date}),"####") + " "
+ totext(datepart("ww",{Orders.Order Date},crMonday),"##")

You could group by {table.date} - 1.

Related

Automating crystal report - need to run for the last week

I have a crystal report I run weekly and manually update the dates to pull the last 7 days (not including today). I've tried to use 'in last7days' and/or {date} >= minimum(lastfullweek) + 1
and {date} <= maximum(lastfullweek) + 1. I can't get this query to run - I get an error saying a string is required here. My date format is yyyy-mm-dd. I need to update this report to run automatically - I don't want to run the report by manually updating the date range every week. Thanks in advance for your help!
You are probably comparing a string to a date. Check the data types of the elements in your expression. Most likely your {date} column is a string rather than a date.
See if you can convert it to a date (e.g. the cDate() function).
Try R-Tag Community Edition. It is free and has the option to set the dates and other values outside the report so you don't have to hardcode them inside the report.

grouping a date range by month in Crystal reports

I have a SP in SQL that will pull data based on a start and end date. What I am trying to achieve in Crystal Reports is a way to group them by Month. most of the account only have 1 usage per month but now an again a few have more that one and I like to have crystal reports display them as a grouped total.
I think I need to make a formula that says is the date month is equal to 01 for Jan 02 for Feb, etc.
But I don't know how to write it.
any suggestions are very welcome
Adding a group for month is fairly simple in Crystal Reports - a good tutorial for an older version can be found here.
In simple steps:
Insert a group section onto your report.
Group on the date field
Select the dropdown for "this section will be printed:" and choose "for each month"

Creating Bins in Tableau for Days in a Week

Could someone please explain me creating BINS based on Weekdays in Tableau? I tried creating different Calculation Fields but it won't work
You're working too hard.
Tableau already knows how to bin values by dates at many levels of granualarity: such as year, month, day, weekday, hour etc. So you don't need to create a new field to bin dates by the day of the week. (creating bins is not difficult, it's just already available in this case)
Just put a discrete (blue) date or datetime field on a shelf. You'll see the date level of granularity displayed like, say, YEAR(MyDateField) with a leading plus sign.
You can either
click on the plus sign to drill down by adding a second level, say MONTH(MyDateField)
or
right click on the field to select the date level of granularity you want
Alex's Answer is exactly correct, Tableau will perform the operation automatically. What is great about is that you can select various formats (Full day name, number, 1 letter or 3 letter day etc.).
However if you absolutely need to you can used this formula:
datepart('weekday',[Date])
to give you the 1 (Sunday) to 7 (Saturday) value if you need it for something other reason, say another calculation.

Grouping Expert, Current date against start date

I am having trouble grouping certain results in a work in progress report that arranges by start date, I have grouped using fixed values before but because the dates keep moving I am unsure what to do.
The start date is WIP_Schedule.Start_Date
the groups I am trying to create are:
[Group1] Overdue = the current date has passed the start date.
[Group2] (Yet to be named) = the current date 2 week period prior to the start date
[Group3] To Do = the current date after the two week period prior to the start date.
I am after a works instruction on how to achieve this.
I know this isn't a lot of information, if you require any more please ask.
Thanks,
Daniel
This is a pretty straightforward requirement, so you should be able to figure it out by searching the web. However, I'll give you part of the answer and hopefully you can figure it out.
Start by creating a formula to figure out the status of the date.
If {WIP_Schedule.Start_Date} > current date then "Overdue"
Else......
Then you can group based on that formula. All you have to do is figure out the rest of the formula.

Total Average Week using a Parameter

I have a crystal report that shows sales volumes called week to date volume. It shows current week, previous week, and average week. The report prompts for a date parameter and I extract the week number to get current week and previous week volumes. Did it this way because Mngmt wants to be able to run report whenever. My problem is for Average Week I cant figure out how to get the number of weeks to divide by for my average. Report originates from June 1st, 2010. Right now I have:
DATEPART("ww", {?date}) - DATEPART("ww", DATE(2010, 6, 1))
This returns 2 right now which is perfect, so i divide my total by 2. This code will work until the end of the year then I'm hooped. Any idea how I can make this a little more dynamic. I was thinking a counter somehow, just can't get the logic down because the date parameter will keep changing, meaning I cant increase my counter by 1 after each week???
Cheers.
Look into the Crystal Reports method: DateDiff.