Programming Performance Point Services 2010 – Create a new Standard KPI


This Post is a Part of Programming PeformancePoint 2010 Series.

public IKPI CreateNewDefaultKPI(string listURL,string kpiName,string description,LocationManagement.Location displayFolder)
        {
            Kpi newKpi = Kpi.CreateNew();
            newKpi.Name.Text = kpiName ;
            newKpi.Description.Text = description;
            // Set the DisplayFolder
            if (displayFolder != null)
            {
                newKpi.Folder = displayFolder.Path;
            }

            // Fixed value actual
            newKpi.Actual.DataSourceLocation = new RepositoryLocation(Constants.FixedValuesDataSourceLocationKey);
            newKpi.Actual.ModelCurrent = 80;    // this sets the value for the actual

            // Fixed value target
            Target target1 = new Target();
            target1.Guid = Guid.NewGuid();
            target1.Name.Text = "Target";
            target1.DataSourceLocation = newKpi.Actual.DataSourceLocation;
            target1.ModelCurrent = 100; // this sets the value for the target
            target1.IndicatorLocation =
                BuiltinIndicators.GetIndicatorByCode(BuiltinIndicators.IndicatorCode.ShapesJagged3Small).Location;
            target1.Pattern = KpiPattern.IncreasingIsBetter;
            target1.RelatedActualId = newKpi.Actual.Guid;
            // set up the banding; 3 bands: < .5; .5 - 1.0; > 1.0
            target1.Banding.ActualWorst = 0;
            target1.Banding.Type = BandType.Normalized;
            target1.Banding.SpreadMaximum = 1.2M;
            target1.Banding.SpreadMinimum = 0;
            target1.Banding.CustomBoundary.Add(.50M);
            target1.Banding.CustomBoundary.Add(1M);
            newKpi.Targets.Add(target1);
            newKpi = PPSWebService.GetInstance().WebService.CreateKpi(listURL, newKpi);
            return new KPI(newKpi);

        }

Part of the Question I always get is how can I create a new Performance Point KPI, The Above function will help you through it.

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s