# Create Your DailyAggregation CRM Analytics Recipe

You join your raw package log file data with your License Management App (LMA) data to create the DailyAggregation CRM Analytics recipe. The recipe produces a dataset called DailyAggregation that you use to create App Analytics recipes.

## Before You Begin

| Required Editions                                                                        |
| ---------------------------------------------------------------------------------------- |
| Available in: both Salesforce Classic and Lightning Experience                           |
| Available in: **Enterprise**, **Performance**, **Unlimited**, and **Developer** Editions |

In your org in Analytics Studio in CRM Analytics:

1. Click **Data Manager**.

2. Click **Dataflows & Recipes**.

3. On the Recipes tab, click **Create Recipe**.

4. Click **Add Input Data**.

5. Select **RawPackageLogFile**.

6. Select all the columns.

7. Create an aggregate with these specifications.

   | Field              | Aggregate By |
   | ------------------ | ------------ |
   | `event_count`      | `Sum`        |
   | `login_key`        | `Unique`     |
   | `num_fields`       | `Sum`        |
   | `num_soql_queries` | `Sum`        |
   | `operation_count`  | `Sum`        |
   | `rows_processed`   | `Sum`        |
   | `session_key`      | `Unique`     |

8. In the aggregate, in Group Rows, click **+**, and select **timestamp_derived**.

   1. Select **Year**, **Month**, and **Day**.
   2. Click **Add**.

9. In the aggregate, in Group Rows, create a group for each of these fields.

   - **api_type**
   - **api_version**
   - **app_name**
   - **class_name**
   - **cloned_from_organization**
   - **custom_entity**
   - **custom_entity_type**
   - **entry_point**
   - **event**
   - **event_subscriber**
   - **http_method**
   - **http_status_code**
   - **log_record_type**
   - **managed_package_namespace**
   - **method_name**
   - **operation_type**
   - **organization_country_code**

10. Create a transform named `Create DMY Field` with this formula.`to_date(concat(timestamp_derived_DAY,"/",timestamp_derived_MONTH,"/",timestamp_derived_YEAR),"dd/MM/yyyy"))`

11. Join your RawPackageLogFile dataset to your LMAData dataset using this information.

    - Select Input Data to Join: **LMAData**
    - Columns to Select: `All fields`
    - Join Type: **Lookup**
    - Join Keys: **organization_id = Subscriber Org ID** and **package_id = PackageID15**
    - API Name Prefix for Right Columns: `LMAData`

12. Join your country-codes dataset to your LMAData dataset using this information.

    - Select Input Data to Join: **country-codes**
    - Columns to Select: `All fields`
    - Join Type: **Lookup**
    - Join Keys: **user_country_code = ISO3166-1-Alpha-2**
    - API Name Prefix for Right Columns: `UserCountry`

13. Create a transform named `Feature Name`.

    1. Create as many CRM Analytics buckets as you need for your features, such as Inventory, Orders, and a catch-all bucket called Other.
    2. :::note
       A CRM Analytics bucket represents a category that you use to group your data. For example, say your app contains multiple features, such as an inventory tracking feature and an order processing feature. Create a CRM Analytics bucket for each feature. Each bucket contains the custom objects, pages, Lightning components, and Apex classes that pertain to that feature. You can use these buckets to create Feature Adoption App Analytics recipes
       :::

       Add your custom entities to the appropriate bucket.

14. Select **Output** and use these settings.

    - Write To: **Dataset**
    - Dataset Display Label: `DailyAggregation`
    - App Location: **PartnerIntelligence**
    - Sharing Source: default
    - Security Predicate: **Apply row-level security to the target dataset by adding a predicate filter condition**
    - Name: `Create Daily Aggregation Dataset`

15. Click **Apply**.

16. Click **Save**.

17. Name your recipe `DailyAggregation`.

18. Click **Save and Run**.

## Example

When complete, your DailyAggregation recipe looks like this.

![The DailyAggregation CRM Analytics recipe with LMAData,        country-codes, RawPackageLogFile datasets, aggregations, and transformations](https://a.sfdcstatic.com/developer-website/sfdocs/platform-pkg-exchange/media/pkg2\_dev/app_analytics_cookbook_tcrm_da_recipe.png)

1. [Monitor the DailyAggregation CRM Analytics Recipe](/docs/platform/pkg2-dev/guide/app-analytics-cookbook-tcrm-da-monitor.md)

   CRM Analytics recipes can take a while to complete. Use these steps to monitor the status of your DailyAggregation recipe.

2. [Run the DailyAggregation CRM Analytics Recipe](/docs/platform/pkg2-dev/guide/app-analytics-cookbook-tcrm-da-schedule.md)

   To create a reusable dataset, schedule your DailyAggregation CRM Analytics recipe to run on a regular basis. We recommend daily at midnight.

**See Also**

**Previous topic:** [Create Your App Analytics Dataset](/docs/platform/pkg2-dev/guide/app-analytics-cookbook-tcrm-da-prepare.md)
