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

How do I create a report to show Current Week and Previous Week?

Status
Not open for further replies.

Hales008

Technical User
Feb 17, 2006
12
US
Hello,

I have only just joined this website today and am new to Crystal Reports. I need help with creating a report, I need Current week values and Previous week values. I'm stuck.... Can anyone help or point me in the right direction? Sample formulas would really help me... I'm having difficulty in getting my variables to work. This is what I had to retrieve all data:

If {View__All_Bids_for_Export.Status<String>}= "Awarded"; Then ToNumber({View__All_Bids_for_Export.BidTotal<String>})

But I now need to extract the current week, (Week Ending 17th Feb '06 - so a Friday) and previous week, Mon-Fri. I was trying the formula below:

NewVal:= {View__All_Bids_for_Export.Status<String>}= "Awarded";

If NewVal in LastFullWeek Then
ToNumber({View__All_Bids_for_Export.BidTotal<String>})
Else
0;

This doesn't work, and I'm not sure why? This was trying to get the previous week? Not sure if this is correct?

Any help would be really appreciated.

Thank you,

Hayley.
 
Hayley

If NewVal in LastFullWeek Then
ToNumber({View__All_Bids_for_Export.BidTotal<String>})
Else
0;
this will not work as NEWVAL is not a datefield. You will need use a date field associated with this record

{View__All_Bids_for_Export.Status}

Ian
 
Try something like:

//{@LastWeek}:
if {View__All_Bids_for_Export.Status} = "Awarded" and
{table.date} in LastFullWeek then
ToNumber({View__All_Bids_for_Export.BidTotal})

Replace {table.date} with your date field.

//{@currentweek}:
if {View__All_Bids_for_Export.Status} = "Awarded" and
{table.date} in currentdate-dayofweek(currentdate)+2 to
currentdate-dayofweek(currentdate)+ 6 then
ToNumber({View__All_Bids_for_Export.BidTotal})

-LB
 
Thank you LB. I appreciate everyone's feedback.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top