Avatar of mj vdb
mj vdb
 asked on

Week numbers and summaries

We want to get the salary status per week number. The user enters the 'year' and the 'until week number'. Crystal Reports works with an excel sheet with payment dates and salary amounts. So far, we have been able to get the week numbers and summaries for the desired 'week range', but we don't get every week number.

Example:
If the user enters '2015' and 'until week number 29', he should get:
-29 weeks (1 to 29)
-Per week number either 'the sum of the salary amounts' or '0'.

The null is required when nothing was earned in a specific week number. In such a case, the excel sheet is useless and the null should be created and combined with the specific week number.

How do we get 'a week number and a null' if the week number ended up with nothing?

We thank you,

Mike ea
Crystal ReportsMicrosoft Excel

Avatar of undefined
Last Comment
mj vdb

8/22/2022 - Mon
MouseCaptain

Sounds like your data range has two colums: Date and SalaryPaid.  You'll need add two additional calculated columns: one to concatenate a unique identifyer using year and week number.  And the other using cumulative addition which resets at the beginning of each year (previous row's YTD + current row's payment, with a condition based on whether year is same as prior row) to calculate salary paid YearToDate.

See attached example.

TJ
YTDsalary.xlsx
Ido Millet

Create a table (or in your case, an Excel named range) with one row per week.
Do an Outer join from that table to the salaries table.
mj vdb

ASKER
Thanks. We specifically didn't expect a tailored sheet. On the long term the approaches may be put into the equation, but they won't make it at this stage. For now, the end user can't enhance the source and the setup can't be changed as well.

Specs:
-Fixed source with columns 'date of payment' and 'salary amount'.
-End user enters 'year' and 'until week number'.
-Crystal goal: show the result (salary sum or null) for each week number. Ytd etc are not required.

W're looking forward to the advices as to how we have to design this in Crystal.

Mike ea
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Mike McCracken

What is your input source?

Is it a database?

Can you provide sample data?
Doesn't need to be real just typical.

mlmcc
mj vdb

ASKER
The excel source we use represents the version the end user has to work with.
The sample shows how basic it is.

Mike ea
sample-source.jpg
Mike McCracken

Is this what you want.  It uses IdoMillet's idea of a date table

mlmcc
Salary-by-Week.rpt
salary-by-week.xls
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
mj vdb

ASKER
Salary-by-Week.rpt:

A) We look for column-2 'Week Number' and column-3 ' Salary for Week' , but they have to be changed.
The issues:
-Example1: column-2 shows two entries for week number 1 and we want one entry per week number.
-Example2: next to week number 4 the cell in column-3 needs to show '0.00'. In fact, for any week number without salary we want to see a '0.00' in column-3. Week numbers without salary / week numbers with '0.00' are not part of the excel source: Crystal has to deal with this on its own.

B) Column-4: there is something going on with the running total, but the case doesn't need it.


In short: when a week number has no salary we want Crystal to generate the number '0.00' in column-3 by itself.


Mike ea
ASKER CERTIFIED SOLUTION
Mike McCracken

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
mj vdb

ASKER
done