Create KPIs Programmatically in PerformancePoint 2007

I created this web project while I was investigating the performancepoint API, it was really a very hard and silly task so I decided to share this code with you 🙂

Firstly, Add a reference to :
\Microsoft Office PerformancePoint Server\3.0\Monitoring\Assemblies\Microsoft.PerformancePoint.Scorecards.Common.dll

using Microsoft.PerformancePoint.Scorecards;
using System.Net;

public partial class _Default : System.Web.UI.Page
private Kpi kpi_wows;
private PmService Publisher;

protected override void OnInit(EventArgs e)
Publisher = (PmService)PmService.CreateInstance(“http://localhost:40000/webservice/pmservice.asmx”);
Publisher.Credentials = CredentialCache.DefaultNetworkCredentials;

protected void Page_Load(object sender, EventArgs e)

private void CreateKPIandSetSomeProperties()
// Create a new kpi instance
kpi_wows = Kpi.CreateNew();
// Setting its name
kpi_wows.Name.Text = “zzz”;
// Setting the Owner
BpmPropertyUser Owner = new BpmPropertyUser();
Owner.Login = @”Server\Administrator”;
kpi_wows.Owner = Owner;
// setting the actual
KpiMeasure ActualMeasure = new KpiMeasure();
ActualMeasure.Guid = Guid.NewGuid();
ActualMeasure.ModelCurrent = 345M;
BpmPropertyText ActualName = new BpmPropertyText();
ActualName.Text = “The Actual”;
ActualMeasure.Name = ActualName;
ActualMeasure.ValueSource = ValueSources.MaxRollup;
kpi_wows.Actual = ActualMeasure;
// Setting the Target
Target ATarget = new Target();
ATarget.Guid = Guid.NewGuid();
ATarget.ModelCurrent = 656M;
BpmPropertyText TargetName = new BpmPropertyText();
TargetName.Text = “The Target”;
ATarget.Name = TargetName;
// Scoring Pattern
ATarget.Pattern = KpiPattern.DecreasingIsBetter;
// Banding Method
Banding TargetBanding = new Banding();
TargetBanding.Type = BandType.Normalized;
TargetBanding.ActualWorst = 999M;
TargetBanding.SpreadMinimum = 0M;
TargetBanding.SpreadMaximum = 1.2M;
ATarget.Banding = TargetBanding;
ATarget.IndicatorId = new Guid(“70b22c72-6523-487d-ae4a-ad607431584f”);
ATarget.IsCustomCurrentFormula = true; // If true, then CurrentFormula is used to compute the current value.
//ATarget.CurrentFormula = “————–MDX Formula Goes Here ————-“;
ATarget.CurrentFormula = “0”;
//Adding Description
kpi_wows.Description.Text = “This is a kpi created by the object model”;
// Assigning Permissions
Microsoft.PerformancePoint.Scorecards.Membership AdministratorMembership = new Microsoft.PerformancePoint.Scorecards.Membership();
AdministratorMembership.Login = @”Server\Administrator”;
AdministratorMembership.Role = “Editor”;
Microsoft.PerformancePoint.Scorecards.Membership ReaderMembership = new Microsoft.PerformancePoint.Scorecards.Membership();
ReaderMembership.Login = @”Server\ayman_elhattab”;
ReaderMembership.Role = “Reader”;
// Assigning the Responsible Person
kpi_wows.Owner.Login = @”Server\Administrator”;

// publishing the KPI



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s