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 derfloh 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 weighted calculated field according to week?

Status
Not open for further replies.

waters130

Technical User
Apr 16, 2007
14
US
I am trying to create a calculated field in Access that needs to have the following criteria.

I am doing a weighted average of sales for a forecast.

The previous 4 weeks sales qtys need to have a weight of 50%
The 4 weeks previous to that need to have a weight of 30%
and the The 4 weeks previous to that need to have a weight of 20%.

Is is possible to do this?

Thanks,

 




Code:
Select iif([DateField]>=Date()-28,.5,iif([DateField]>=Date()-28*2,.3,iif([DateField]>=Date()-28*3,.2,0)))*[Sales Qty]


Skip,

[glasses] [red][/red]
[tongue]
 
That helps give me a good idea of what to do, the criteria for the other other weights (other than the .5) need to look at weeks 5-8 and 9-12 not just the current date -28 days, how would I do that?
 



Did you not look at the nested iif statements...

Date()-28*2

Date()-28*3

Skip,

[glasses] [red][/red]
[tongue]
 
I didn't look close enough at the nested iif statements.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top