How to do it...

First, we will need to create a view that flattens the service data into one view. To do this, follow these steps:

  1. Create a new view called ConWHSVehicleServiceExpanded.
  2. Add the ConWHSVehicleSErviceTable table as the root data source and ConWHSVehicleServiceLine as a child data source, as shown in the following screenshot:
  1. Either set Use Relations property on the ConWHSVehicleServiceLine data source, or add a relation manually.
  2. Add all non-system fields from the ConWHSVehicleServiceTable table, and the ItemId field from ConWHSVehicleServiceLine.
  3. Save and close the view.

We can now create the aggregate measure, which is done by following these steps:

  1. In the project, add a new item, and in the Add New Item dialog, select Analytics from the left-hand list and Aggregate Measurement from the right.
  2. Name the new item as ConWHSVehicleServiceMeasure.
You may notice that many existing aggregate measures are suffixed with Cube; this is the legacy naming convention from AX 2012.
  1. The designer will open with a default measure group node named MeasureGroup1. Rename this to ServiceInformation.
  2. Set the Table property to ConWHSVehicleServiceExpanded.
  3. We will add three measures, a count of service records, a count of items used, and a count of vehicles. Right-click on the Measures node and choose New Measure; add them using the following settings:

Name

Default Aggregate

Field

ServiceRecords

Count

ServiceId

Items

Count

ItemId

Vehicles

Count

VehicleId

To add sum aggregates for value or quantity fields, set the Default Aggregate property to Sum.
  1. Let's add the aggregate dimensions first by expanding the Dimensions node and noticing that it has already created two dimensions: Company and Date_.
The underscore is to avoid problems should this be deployed to SQL Server Analysis Services (SSAS). If you save without this underscore, you will get a warning. This also occurs for other Transact-SQL keywords, such as Description.
  1. Rename the Date_ dimension and the sub-node to ServiceDate, as shown in the following screenshot:
  1. It will have guessed the relation for the Company dimension automatically; however, it has no idea how to relate the Date_ dimension to the view. Select the relation node (the final node under the ServiceDate dimension) and set the Related Field property to ServiceDateRequested.
  2. The completed ServiceDate and Company dimensions should look like the following screenshot:
  1. Let's add our ConWHSVehicles aggregate dimension: drag the ConWHSVehicles aggregate dimension from the project to the Dimensions node.
  2. In this case, if you expand the new dimension, you will see that that the VehicleId relation is set for us; if this is not set, we must specify it.
  3. Let's add a standard dimension to our aggregate measure. From Application Explorer, locate the ReleasedProducts aggregate dimension from Analytics | Perspectives | Aggregate Dimensions.
  4. Drag ReleasedProducts to the Dimensions node.
  5. This time, the relation is not set. To do this, set the Dimension Attribute property to ReleasedProducts.
This was selected as this is the key attribute and has ItemId as the key attribute. Convention guides us to know that the attribute with the same name as the aggregate dimension is the key attribute. Of course, we can simply open the aggregate dimension in the designer to check.
  1. Select the new relation and the Related Field property to ItemId. The current state of our design should be as in the following screenshot:
  1. Finally, let's add a custom attribute to the aggregate measure. This is not normally done, because they can't be reused elsewhere. Right-click on the @ Attributes node and select New Dimension Attribute.
  2. Complete as before, the result should be as per the following screenshot:
  1. Save and close the designer.
  2. Build the project and perform database synchronization.

Next, we will configure the entity refresh batch job.

  1. In order for the data to be deployed and automatically refreshed, navigate to System administration and choose Setup | Entity Store.
  2. Select the entities that should be refreshed and click on Refresh.
  3. In the Configure refresh dialog, expand Run in the background, click on Recurrence, and configure as per the following screenshot:
Only make this as frequent as it needs to be. As this will run for the selected entities, we can configure entities so that they are refreshed at different rates.
  1. Press OK on the Define recurrence dialog, and OK on the Configure refresh dialog.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.212.186