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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ignore previous years Value

Status
Not open for further replies.

Jamjune

Technical User
Aug 30, 2009
4
US
In my report I have a string called DU (Which is a business unit) So someone could be in AFA DU last year and FIA DU this year. The report compares say last year August to this year August. I want to group people by this years DU and have this year and last year on the same row but I cannot make that happen. It puts the last year numbers under lasts years DU and this year under this years so for those folks who were in a different DU last year they have two line. Any ideas? Using Crystal 8.5.

Thanks!
Jamjune Crystal 8.5
 
You should post some examples of what results you are getting now and then a sample of what you want it to look like. Add any formulas you have created.


_____________________________________
Crystal Reports XI Developer Version
Intersystems Cache 5.X ODBC connection

 
In Design, the report structure would be something like this:

-------------------
Person Group Header
-------------------
Year Group Header
-------------------
Detail Band
-------------------
Year Group Footer
-------------------
Person Group Footer
-------------------

You'll need, at most, three different formulas to pull this off. Here is a run down of what each one would be and how they would look.

"PreAugHolder" (Used to hold onto last year's august info.)

shared stringvar PreAug:=DU
//"DU" is a placeholder and should be replaced with the that DU string variable you referred to in your post.


"PreAug" (Used to display last Aug)

shared stringvar PreAug;
PreAug;


"Sweeper" (Used only if you are running multiple people in one report to clear shared variables between the different people)

shared stringvar PreAug:="";



Now you just need to place them in the correct location and supress the right bands. This is what your design view would look like after placing these new formulas.

-------------------
Person Group Header @Sweeper <--(Supress)
-------------------
Year Group Header
-------------------
Detail Band @PreAug
-------------------
Year Group Footer <--(Supress) @PreAugHolder
-------------------
Person Group Footer
-------------------


If you follow what I've done, the Detail Band will show the last detail band's "DU" which equates to last year's August "DU" since we are grouping by Year. Right next to it you could drop your August "DU" string to display the current year's August "DU".

The report then rolls down to the the Year Group Footer and stores that current year's "DU" to be used in the next record.

Finally, when you've run all the details you need for that person and crystal rolls on to the next person, the stored "DU" information from your last person is swept clean by the "Sweeper" formula.

I hope this helps.
 
If the fields literally look like "FIA DU" and "AFA DU", then create a formula:

if right({table.busunit},2) then {table.amt}//or 1 for a count

Use this as your summary field in an inserted crosstab, using sum as the summary field (even if it's a count).

Then use:

month({table.date})

...as your first column field, and

year({table.date})

...as your second column field.

-LB
 
Thank you for the suggestions. I will put them to work tomorrow!

Thanks!
Jamjune Crystal 8.5
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top