Skip to main content
Gainsight Inc.

Tutorial - Aggregate Usage Data with Bionic Rules

In this tutorial, we’ll use Bionic Rules in order to query for usage data related to page views and then pivot the data to aggregate it either by week or by month. This will be accomplished by creating a Dataset Task that queries the usage data within the MDA, and then creating a separate Dataset Task that pivots the data and completes the aggregation.

  1. In the Edit Rule section, select Rule Type as Bionic and in the Rule For selection, choose Account.

Snip20170202_1.png

2. Click NEXT to move on to the Setup Rule step.

3. In Setup Rule, click DATASET TASK in order to begin creating the tasks the rules will need to complete.

Snip20170202_5.png

4. Set a Task Name and an Output Dataset Name for your Dataset Task. The Task Name will be used to identify the task within the rule, while the Output Dataset Name will be used to identify the resulting data after the task completes. We also recommend adding a Task Description with more details about the action the task will be completing. 

In our example, this task will fetch data from the MDA and then pivot on the Page Name; so we have named the task, its description, and its output dataset name, accordingly:

Snip20170202_7.png

5. Since the goal of this rule is to fetch data from the MDA, select the object that you previously uploaded your Usage Data into. Select the fields that you would like to reference as part of the pivot and the aggregation and add them to the Show section. In our example, we’ve selected the example object Usage Data. In the Show section we’ve added the fields Account and Account Name (in order to tie this data back to those records). We’ve also added Date, Page Name, and Views as those will be necessary fields for the Pivot and Aggregation.

Snip20170202_4.png

Note: While not necessary to complete this tutorial, each Dataset Task also has a section for exporting the resulting data to the S3. For more information on the options presented, check here. Select the exporting option that works best for your team.

6. Click SAVE in the top-right to save the task.

Snip20170202_9.png

7. Go back to the Setup Rule and select +TASK in order to add a new Dataset Task. Because we will be using this to complete our pivot and aggregate the data, select Pivot from the resulting drop-down.

8. Enter the Task Name, Task Description, and Output Dataset Name for this task. Since we will be using this task to pivot on page data and aggregate by date, we named our example accordingly.

Snip20170202_13.png

9. Under Dataset, select Fetch from MDA in order to pull in the data fetched by our previous task. Also add the fields Date Field and Account into the Show section, as we will need to reference that data within the task.

Snip20170202_14.png

10. Move the value Page Name under the Pivot On section. This will allow us to configure the pivot.

Snip20170202_25.png

11. After moving this field to the Pivot On section, you will be prompted to configure the pivot conditions. 

Configure these conditions to reference the Values of the Page Name. Use the Output Field Label to determine how the pivoted data will be identified, and the Aggregation to determine how the data will be aggregated. The Field column determines what data will be selected as part of the pivot. 

Using our example data, we’ve set conditions to pull in Views based on Page Name, which you can see below:

The Default Value column will determine the value of data that is fetched, but does not meet the pivot condition. We’ve set this to 0, because we do not want views from other pages to throw off our aggregations.

12. Once this is configured, click OK to set the conditions.

13. In the GroupBy section, select Date Field and Account to ensure the aggregation successfully groups the data by time for each account.

14. Click the gear icon on the Date Field in order to select how frequently you would like the aggregation to be grouped by. For weekly aggregation, select First Day of Current Week or Last Day of Current Week. For monthly aggregation, select First Day of Current Month or Last Day of Current Month.

Snip20170202_18.png

15. Click SAVE.

These actions should successfully aggregate page views for each account either weekly or monthly. You can then select the actions you’d like to take based on this data within the Setup Action of the rule. For more information on how to set rule actions, check the article Setup Rule Action Types.

Note: The Send Email and Load to Relationship Related Objects actions are not supported for Account Bionic Rules, and only the Call to Action and Load to Relationship Related Objects actions are supported for Relationship Bionic Rules.

  • Was this article helpful?