Creating yearly comparison after summarizing datediff in Crystal Reports - crystal-reports

I created a report that calculated how many days it took a person to complete a task (datediff) and then calculated the avg. number of days it took a group of people to complete the same task (by summing the datediff and then inserting an "avg." function). The time frame used was set by using a "Start date" and "End date" parameter field.
Now, the end user is asking, "how does that average compare to last year?"
I gave a quick answer by creating a Cross tab where I made the "Start date" 01/01/2018 and the end date 12/09/2019 and then grouped by Year in the columns. That is not an exact year-to-year comparison since this is all of 2018 compared to YTD 2019.
I know there is a better way to do this. Any help is appreciated!
Each task has a unique ID, a start date, and an end date

Try using a subreport that shows the same summary data as the primary report, but for a modified set of Start and End Dates. Link the subreport using both Start Date and End Date, but subtract one year from each value. This will allow your primary report to show data for 1-1-2019 through 12-09-2019 and the subreport will show 1-1-2018 through 12-09-2018.
Here is the formula to subtract 1 year from a date.
DateAdd("yyyy", -1, {#StartDate})
You can use this formula in your selection criteria for the subreport or you can create a formula field in the subreport as well, then use that formula field in the selection criteria.

Related

How to calculate YTD hours on a Crystal Report?

My company has a payroll program that prints payroll checks and pay stubs using Crystal Reports. The report selects payroll data from a table that has these columns: Hours, PeriodAmount, and YTDAmount. The hours are based on payroll period ending date. The report selects records based on a single pay period end date. So, hours would be selected for a single pay period only. However, we would like to print YTD hours on the pay stub. In other words, hours accumulated from beginning of year to current pay period. Since YTD hours is not a column in the table, would we need to include a sub report to accumulate hours? I don't think running totals would work since we are selecting a single period only. Any thoughts? Thanks.
Yes, a subreport is one option.
Another option is to select all pay periods in the current year and compute the total for the current period using a conditional total. For example, create af ormula that returns the hours if the record belongs to the current period and zero otherwise. Then, SUM that formula per employee. That SUM would give you the hours in the current period.

Dates in google sheets

I am very new at all of this, and I don't know if what I want to do is even possible, but I'm hoping someone can assist me with some formulas if it is.
I am trying to create a spreadsheet for my business's scheduling purposes. I have created a spreadsheet that lists my PO's, start date, end date, location, project hours, and total days.
I currently have a couple formulas on the sheet. When I enter the project hours in column e the formula =roundup(E2/24) inputs the expected total days of work into column f.
I have a starting date of 7/1/2022 entered in b2 then have a formula that looks at column c (end date) and adds the amount of days from column f (total days) to the end date. Each line there after copies the end date from the row above to the start date and then adds the total days from f to that to complete the next row.
What I would like to do is have the dates only reflect workdays (M-F) instead of returning all dates. Is this even possible?
Take a look at spreadsheet example, but it is pretty basic.
Thank you in advance for any help you can provide!
I understand that you want to add "Total days" to the "Start Date" to get the "End Date" excluding weekends, in this case Sundays and Saturdays.
Paste this formula in cell C2 "End Date" column.
=ArrayFormula(IF(E2:E="",,WORKDAY.INTL(B2:B,F2:F,"0000011",)))
Breakdown:
1 - ArrayFormula output's values into several rows and/or columns, and to make the formula dynamic.
2 - WORKDAY.INTL determines the date after a certain number of workdays, excluding certain number of weekends and holidays.
3 - [weekend] argument using string method of ones and zeros "0000011" to specify workdays and weekends, 0 workday, 1 weekends starting from Monday to Sunday.
here is the link to the spreadsheet, hope that answerd your question.

Filter SSRS subreport for 12 months from first day of month to last day of month

I have a SSRS report that has typical Start Date / End Date parameters that will filter out Sales Order information based on the OrderDate field. With this report, I have a subreport. This subrebort is basically nothing more than an aggregation of the same info, by month. This aggregate information should be from the first day of the month, one year prior, through the last day of the End Date's parameters month. This does not take the main subreports Start Date parameter into consideration at all.
This is where it gets a little tricky. For example, lets say I made the start date / end date parameters on my main report:
10/15/2016 - 11/15/2016
(just remember, for this purpose, the start date is irrelevant)
I would want the subreport to show the sales totals, per month, for the ENTIRE month of December 2015 through the ENTIRE month of November 2016, even though my end date was 11/15/2016.
If I were to put in those same dates for my parameters in the report right now, for the aggregation of December 2015, I would only get sales from the 15th through the 31st. Currently I have my subreport to filter on the OrderDate by:
Fields!OrderDate.Value>= DateAdd(DateInterval.Month, -12,Parameters!EndDate.Value)
I know that this filter is not currently set up to have an end date for the parameter, just a greater than argument, which is wrong since I want the 12 month history to stop at the last day of the month for the month of my End Date parameter, but I don't know how to make that happen either.
I hope I have explained this well. Any help on this would be greatly appreciated.
You can set a filter to get only dates between a specific range in your subreport dataset, tablix and some visualizations:
In DataSet properties or Tablix Properties in the Filter tab use these settings:
In the Value textboxes you should use the expressions to calculate your date range.
StartDate
=DateSerial(Parameters!EndDate.Value.Year-1,Parameters!EndDate.Value.Month,1).AddMonths(1)
EndDate
=DateSerial(
Parameters!EndDate.Value.Year,Parameters!EndDate.Value.Month,1).AddMonths(1).AddDays(-1)
It should filter your data from 12/01/2015 to 11/30/2016 if your EndDate parameter is set to 11/15/2016
Let me know if this helps.

Reporting and filtering dates in access 2007?

I'm having a customer look up a report between FROM and TO dates. Basically for any month a client can request a report, what I need to do is show the QTY of units in the inventory as of the last day of previous month. So if client is looking to make a report for 12/23/2015 - 12/28/2016 then I need to show the QTY of units in inventory (beginning inventory) on 11/30/2015. I had someone recommend I use DateSerial, but it doesn't seem to do what I want it to do. Basically the FROM AND TO dates are values that I pass on from a Visual Basic application into an empty form and they get used in the report.
I'm not sure if I need to make changes to my queries. Here's what the report does..
With the report, I need to be able to show the client the following...
ItemID
Beginning Inventory (as of last day of previous month)
Unit Price
Bought Units (for report date)
Sold Units (for report date)
Returned Units (for report date)
Subtotal (of bought +sold+returned)
Inventory on hand (beg + subtotal)
So what I do is in my first query I get the Unit Price, and Beginning Inventory (currently not filtering by last day of previous month).
Then I have 3 more queries, one for Bought, Sold and Returned where I link the ItemID's and I filter the TransactionDate (between dates form!formdates!txtFrom and form!formdates!txtTo).
Then I have the last query where I combine the first one with the other 3. Now I'm pretty sure I should include the DATESERIAL() function in the first query? And filter the TransactionDate (this is the column i need to look through to count beginning inv, as well as look for Bought, Sold, Returned Items).
Please help!
The DateSerial() function should return the last day of the previous month. Here is an example query for your problem:
SELECT ID, myDate
FROM Table1
WHERE (((myDate)=DateSerial(Year([enter start date:]),Month([enter start date:]),0))) OR (((myDate) Between [enter start date:] And [enter end date:]));
Documentation: https://msdn.microsoft.com/en-us/library/bbx05d0c(v=vs.90).aspx

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"