Exercise - Create New Fields
Now that you’ve learned how to define your schema and have created new fields using field-building functions, let’s try some on your own
Exercise 1 - Add new field - offered_approved_delta
In our first exercise, let's create a new field using our field build functions.
Can you create a field that will hold the delta between the "offered_amount" and "approved_amount"?
- Bonus - as this is a numeric field, can you also create a segmentation for this field?
In the next exercise, we will create another field so hold-on on backfilling until all the new fields are ready.
See Solution
Create Field
- In the "Configurations Page" under the "Fields" tab, Click on “add field”.
- Add a name - we will call this field “offered_approved_delta”.
- Under "type", choose "numeric".
- Under “function” we will choose the “delta” function and add the 2 sources - “offerd_amount” and “approved_amount”.
- When all is set we will click on "add field" to save it.
Add Segmentation
- Under “segmentation” add a new segmentation.
- Choose the type - either by "bucket size", by "number of buckets", as a "logarithmic scale", or "discrete".
Exercise 2 - Use this field to create another field - offered_approved_delta_normalized
Now that you created "offered_approved_delta", use this field to create another new field.
Can you create a normalized delta field for offered and approved amounts? Normalized in this case means divided by the offered amount.
See Solution
Create Field
Use the previous field to create another field.
- In the "Configurations Page" under the "Fields" tab, Click on “add field”.
- Add a name - we will call this field “offered_approved_delta_normalized”.
- Under "type", we will choose "numeric".
- Under "function" we will choose "divide".
- Under "sources", we will add "offered_approved_delta" as the first source and "offered_amount" as the second.
- When all is set we will click on "add field" to save it.
Add Segmentation
- Under “segmentation” add a new segmentation.
- Choose the type - either by "bucket size", by "number of buckets", as a "logarithmic scale", or "discrete".
As this is a normalized field, the values range from 0 to 1, so 20 buckets of 0.5 in size would work well here.
Backfill your data
Once both fields are created, you should now backfill the data in order for the new fields to be written in the data.
References:
Field Build Functions
Updated over 2 years ago