Design KPIs

Completed

KPIs can be created in the developer environment and then embedded into workspaces to provide users with key measurable values that allow them to see how business is performing. The below image shows an example of a KPI tile in a workspace.

Screenshot of the KPI tile in a workspace.

KPIs should have clear objectives that are periodically reviewed to ensure that the objectives are being met. KPIs can be created by using aggregate data contained in aggregate measurements, which is a model that contains a collection of measures and their corresponding dimensions. The measures that are used are aggregate numbers, such as total sales. Aggregate measurements can be set to measure the sum, minimum, maximum, count, distinct count, or average by using the Default aggregate property.

By default, the Default aggregate property uses the count measure. You can deploy the aggregate measurement two ways by using the Usage property.

  • InMemoryRealTime uses Column store indexes of the SQL Server database to get real-time data.
  • StagedEntityStore uses the Entity store that uses near real-time Power BI reporting. This option allows you to deploy the measure to the Entity store and have the data refreshed periodically.

Dimensions are slicers that can be used to analyze data. From these aggregate measurements and dimensions, you can create an aggregate data entity. You can use the aggregate data to define a KPI by using X++. After the KPI has been defined, users can customize it at run time.

Diagram of the relation between aggregate measurements and dimensions and the KPI that they define.

Create a new project in Visual studio

To create a new project in Visual studio, follow these steps:

  1. Open Visual Studio as an Administrator and under Get started, select Create a new project.
  2. In the search box, type Finance Operation and select the template for finance and operations project and select Next.
  3. Name your Project NewKPI and select Create at the bottom of the page. This will create your NewKPI project.

Create aggregate measurements

To create aggregate measurements, follow these steps:

  1. In the Solution explorer, right-click your project and select Add New > New item.
  2. Under Dynamics 365 Items select Analytics > Aggregate Measurement.
  3. Open Application Explorer by going to View > Application Explorer if it does not already show up on your page.
  4. Go to Data Model > Views and select the FMVehicleExtendedView view to create measurements. Because the project model is Fleet Management the FMVehicleExtendedView view is compatible.
  5. Drag and drop the FMVehicleExtendedView view in the MeasureGroup1 group for the Aggregate measure.
  6. In the Dimensions group, right click on Date and select Delete.
  7. In the Application Explorer, right click the FMVehicleExtendedView and select Open designer. Split the resulting pane alongside the Design pane for your AggregateMeasurement object.
  8. Drag and drop the Mileage field from the view to the Measures group in your AggregateMeasurement.
  9. Each measure has a default Aggregate property that you can set:
    • Count
    • Sum
    • AverageOfChildren
    • DistinctCount
    • Max
    • Min
  10. Save all, and then build the project to see if it compiles correctly. This can be done by right clicking the project and selecting Build.

Create aggregate dimensions

To create aggregate dimensions, follow these steps:

  1. In the Solution explorer, right-click your project and select Add New > New Item.
  2. Under Dynamics 365 Items select Analytics > Aggregate Dimension, and then select Add.
  3. In the Application Explorer, go to Data model > Views and select the **FMVehicleExtendedView ** view to pull measurements.
  4. Drag the selected item onto the root of the AggregateDimensions object that you’ve created.
  5. There may be automatically created attributes in the Attributes group of your dimension. Delete these or change the Dimension field property to Model.
  6. If you don’t have an attribute or didn’t change the Dimension field on the original attribute, drag the Model field from the view into Aggregate dimension > Attributes.
  7. Save all, and then build the project to see if it compiles correctly. This can be done by right clicking the project and selecting Build.

Create model dimension references

To create model dimension references, follow these steps:

  1. From the Solution Explorer, drag and drop the Aggregate dimension into the Aggregate measurement's Dimension node in the middle of the page.
  2. Right-click the Dimension node and select New Dimension, and rename the new dimension.
  3. Select the newly created dimension, and then right-click and select New relation.
  4. Name the new relation and change the Dimension attribute to Model.
  5. In the child node, set the Related field property to Model.
  6. Save all and Build.

Deploy aggregate measurements

To deploy aggregate measurements, follow these steps:

  1. Select the aggregate measurement.
  2. Set the Usage property in Properties:
    • InMemoryRealTime
    • StagedEntityStore
  3. Right-click the aggregate measurement in the Solution Explorer, and select Add Column Store Indices.

Create the aggregate data entity

To create the aggregate data entity, follow these steps:

  1. In the Solution explorer, right-click your project and select Add new > New item.
  2. Under Dynamics 365 items select Analytics > Aggregate Data Entity.
  3. Select Add.
  4. Drag and drop the aggregate measure from the Solution Explorer to the data source of the aggregate data entity shown on the Designer Window.
  5. In the data source, expand the DataSource, expand the Aggregate data measurement, expand the measure group (Mileage), and Measures, and then drag Mileage into Fields.
  6. In the data source, expand the DataSource, expand the Aggregate data measurement, Expand the measure group (Mileage), and Dimensions, then drag AggregateDimension into Fields.
  7. Right-click on the added field and open Properties.
  8. In Properties, go to the Attribute property in the Data section. Set the attribute value to any value.
  9. Save and build the solution.

Create a KPI

To create a KPI, follow these steps:

  1. Right-click the project and select Add > New Item.
  2. Under Dynamics 365 items select Analytics > Key Performance Indicator.
  3. Select Add.
  4. Set the Measurement property to select the measurement for the KPI in the Properties section.
  5. Select the Value node of the KPI.
  6. Set the measurement group on the Measure group property.
  7. Set the measure on the Measure property.
  8. Select the Goal node of the KPI.
  9. Set the Goal Type property to BasedOnMeasure.
  10. Set the measurement group on the Measure group property.
  11. Set the measure on the Measure property.
  12. Select Save and Build.

Add the KPI to a workspace

To add the KPI to a workspace, follow these steps:

  1. Right-click the project and select Add > New item.
  2. Select User Interface > Tile.
  3. Select Add.
  4. Drag and drop the KPI from Solution explorer onto the tile in the Tile designer.
  5. Save.
  6. Create an extension of an existing workspace form or create a new workspace form. Ensure the solution model matches the workspace form model, otherwise you cannot make an extension of that form. Create an extension by right-clicking on the form in the AOT.
  7. In the Designer, add a Tile button. You may need to change the pattern of the form to custom to do this.
  8. Set the Tile property drop-down option to the KPI tile that you created.
  9. Save all and build the solution.
  10. The workspace will show the new KPI that was created. Select the KPI tile to view details.