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.
![96877e4-Screen_Shot_2021-09-22_at_11.01.56.png 1190](https://files.readme.io/cf88927-96877e4-Screen_Shot_2021-09-22_at_11.01.56.png)
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".
![Screen Shot 2022-05-02 at 16.14.00.png 1459](https://files.readme.io/570327a-Screen_Shot_2022-05-02_at_16.14.00.png)
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.
![5b7a217-Screen_Shot_2021-09-22_at_11.02.20.png 1192](https://files.readme.io/c3c6e97-5b7a217-Screen_Shot_2021-09-22_at_11.02.20.png)
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.
![9031f77-Screen_Shot_2021-08-29_at_16.16.24.png 2348](https://files.readme.io/b1ef362-9031f77-Screen_Shot_2021-08-29_at_16.16.24.png)
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 about 2 years ago