Recalculate EV Fields

S

Sebastian Cordoba

Hello everyone.

I need to find a way to recalculate EV fields without overwriting an
existing baseline. In order to get it, I've developed a macro to assign a
specific standard rate to the plan's resources ($1/hr) and then assign the
new cost (calculated by Project) to the baseline cost field of each task.

I assumed that all of the EV fields were going to be calculated by Project
as well, but it didn´t happen. Is there a method to do something like:
mytask.BCWS.recalculate()

Thanks for your help.
 
R

RobV

Sebastian: first, there are a couple assumptions: resources must be assigned
to tasks, and a baseline must have been set. Given those assumptions, assign
the rate to the resources (cover both standard and overtime rates for
completeness). Make sure the status date is set to encompass the period
you're analyzing: ActiveProject.StatusDate = <target date>. Then, have
Project recalculate the EV using the command: CalculateProject. The tool
will recalculate the Earned Values, and it will not overwrite the baseline
unless you explicitly tell it to do so.
 
S

Sebastian Cordoba

Hi RobV. Thanks for your help.

I'm sorry but I'm kind of new with this macro thing. Could you be more
specific about the methods you've just described, becauseI have two doubts:
1- Is it necessary to update STATUS DATE? Because so far my indicators have
been calculated against CURRENT DATE.
2- How do I invocate the method CalculateProject? It doesn't work with
"ActiveProject.calculateProject".

Thanks for your patience.
 
R

RobV

Sebastian, Jan is one of the gurus on this site--he's an MVP. And, as usual,
he's right about the syntax of the command and usefulness of the Help system.


As for your question on the date, Project uses Status Date for its EV
calculations. You can see this for yourself: open a schedule, go into
Project, Project Information, and set the Status Date to different dates.
Assuming that you have Calculate set to Automatic (Tools, Options,
Calculation, Calculation Mode), the tool will dynamically change the values.
 
R

RobV

Jonathan, I don't believe that's correct. Both the Project Help entry for
Status Date and my own experimentation indicate that Status Date is the
driver for EV calculations. Current Date does not appear to affect the BCWS
and BCWP values. Please let me know if I'm missing something.
 
S

Sebastian Cordoba

Hi guys.

First of all, thanks for your help. A couple of comments:

1- What Jonathan said is true. When Status Date = NA, EV fields are
calculated against Current Date (that's my case).
2- The command "Application.CalculateProject" doesn't seem to work. EV
fields remain the same (0) after running my macro. Am I doing something
wrong? This is the code:

Sub workCost()

Dim mytask As Task
Dim LCost As Double
Dim LResource As Resource
Dim LPrize As Currency
LPrize = 1

For Each LResource In ActiveProject.Resources
If Not (LResource Is Nothing) Then
LResource.StandardRate = LPrize
End If
Next LResource

For Each mytask In ActiveProject.Tasks
If Not (mytask Is Nothing) Then
mytask.BaselineCost = mytask.Cost
End If
Next mytask

ActiveProject.ProjectSummaryTask.BaselineCost =
ActiveProject.ProjectSummaryTask.Cost

Application.CalculateProject

End Sub
 
S

Stephen Sanderlin

Yes. you're only setting baseline cost. the EV fields are calculated
using multiple baseline fields, none of which you are setting (except
for, obviously, baseline cost). Further, in my opinion, you really want
to be using the BaselineSave() method to save Baseline 0.

--

Stephen Sanderlin

Principal Consultant

MSProjectExperts



For Project Server Consulting: http://www.msprojectexperts.com

For Project Server Training: http://www.projectservertraining.com



Read my blog at: http://www.projectserverhelp.com/

Join the community at: http://forums.epmfaq.com
 
R

RobV

I never leave the Status Date set to NA. Thank you both for the insight into
this behaviour.

Sebastian, as for your code, I think you still not getting the point. You
can't force the EV calculations using baseline costs. The tool will do the
calculations: all you have to do is set the rate, the baseline, and
recalculate. To expand on Stephan's comment, give this a try:

Dim LCost As Double
Dim LResource As Resource
Dim LPrize As Currency
LPrize = 1

For Each LResource In ActiveProject.Resources
If Not (LResource Is Nothing) Then
LResource.StandardRate = LPrize
End If
Next LResource

BaselineSave All:=True

Application.CalculateProject
 
S

Sebastian Cordoba

Hi guys.

I really appreciate your help. I just want to explain myself again through
this scenario:

1. My PMs have ALREADY set a baseline for their projects.
2. That baseline doesn't include costs because by the time PM's set it,
Standard rates were set to $0/hr. In other words, we didn't consider any kind
of cost.
3. I need to add the cost component to the EXISTING baseline. So that EV
calculations can be performed.
4. Since PMs have updated their projects (dates, work, duration), I'm trying
to avoid the "Set baseline" option, because I dont' want to lose the previous
saved information.

For those five reasons I want my macro to set the Standard rate, update
baseline COST and then recalculate EV fields. That last step is the one that
brings me trouble because "Application.CalculateProject" command doesn't
update EV fields, even if all baseline fields are properly defined.

Setting a new baseline which includes costs would be my last option, but If
I have to do it I will. Thanks.
 
R

RobV

As far as I know, within the tool, you can do the re-calculation only by
using the Baseline/Recalculate approach described.

As I mentioned in an earlier email, you won't affect their baseline unless
you explicitly save the file. So, you could use the code provided and
see/report on the result (for instance, through Excel). And, then, exit
without saving.

If, for some reason, you need to recalculate the Earned Values AND save the
file, you'll have to save a baseline. In that case, consider leaving the
default Baseline 0 for the PM and using another baseline, e.g., Baseline 1
for your saving and retrieval. That approach would leave their default
baseline intact and give you one for your own purposes. The syntax for
saving into Baseline 1 is: BaselineSave All:=True, Copy:=0, Into:=11.
 
S

Sebastian Cordoba

Hi Rob.

How can I modify the Start value for a task? I'm trying to replace it with
the baselineStart value but apparently the first one is a read only field.

My code goes like: myTask.Start = myTask.BaselineStart, but it doesn't
work. Is there a faster way to replace the actual values (Start, Finish,
Duration, Work) with the baseline ones?

Thank you.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top