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.

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
Avatar of 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.

Avatar of Ido Millet
Ido Millet
Flag of United States of America image

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.
Avatar of mj vdb
mj vdb


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.

-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
What is your input source?

Is it a database?

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

Avatar of mj vdb
mj vdb


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

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

Avatar of mj vdb
mj vdb



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
Avatar of Mike McCracken
Mike McCracken

Blurred text
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of mj vdb
mj vdb


Microsoft Excel
Microsoft Excel

Microsoft Excel topics include formulas, formatting, VBA macros and user-defined functions, and everything else related to the spreadsheet user interface, including error messages.

Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews


IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo