Add formula

Add formula





You can create new columns and customize them using the Formula column transform. Zoho DataPrep offers a variety of functions to suit your needs. Click here to know more about the functions.

To create a formula column

1. Click on the Transform menu and select the Formula column option.
2. Provide a name for new column name in the New column name field.
3. You can insert the functions in the Formula field by typing the function names, or use the intelliSense to complete the functions. You can also apply filters and search functions in the Click to insert functions section.
4. You can also click the Formula builder powered by OpenAI ChatGPT tile to generate formula by sending prompts to ChatGPT API. Click here to know more.
5. You can add parameters to the formula, or use intelliSense to choose columns. You can also search for column names in the Click to insert columns section.


6. DataPrep shows a live preview of the changes made to the formula when you click on the Preview button. 
7. Click Apply to apply the changes.

Formula Generator built with OpenAI ChatGPT API



Zoho DataPrep helps you generate formula powered by ChatGPT API, a generative artificial intelligence developed by OpenAI. Using the formula builder, you can enter your data requirements as prompts and the formula will be generated automatically. To enable this feature in your DataPrep organization, go to the OpenAI Integration tab in the Settings page. Click here to know more about enabling OpenAI integrated features. 

Here's a quick promo on the overall integration with OpenAI ChatGPT API. 



Here's a quick demo on the features in Zoho DataPrep powered by OpenAI's ChatGPT API. 



InfoData Privacy Notice: Zoho DataPrep utilizes OpenAI's ChatGPT API, an external service based in the USA, subject to OpenAI's Terms of Use. Please be aware that the information sent to OpenAI depends on the access provided by you, the user. The data shared with ChatGPT API is based on the features you enable. Details such as column names and/or selected cell data will be shared based on each feature. You can choose to enable or disable each feature based on the level of data you want to share. Therefore, exercise caution while using this service and ensure that the data you provide does not contain confidential or personal information. 

Go to OpenAI Integration in the Settings page to learn more about configuring this integration.

Notes
Notes
  1. The generative response are coming in from ChatGPT's training data. Accuracy, consistency, and relevance of the response are subjective to the type of prompts and the data available in its training set. 
  2. ChatGPT doesn't respond to prompts about personal information.

To generate formula built with ChatGPT API
     
1. Click on the Transform menu and select the Formula column option.
 
2. Click on the Formula builder powered by OpenAI ChatGPT tile to open up the the Formula prompt.

3. Describe the logic of your formula in natural language in the Formula prompt. As you enter the prompt, you can also mention the column names that you want the logic to apply to, and click Generate.

The required formula will be automatically generated in the Generated formula section.

You can get the output column names contextually auto-generated by ChatGPT based on your input prompt.

The Add formula transform is now equipped with a re-try mechanism which gets you the best result out of ChatGPT's response by re-trying the query automatically in a different way if the output data did not match your expectation.

Notes
Note: Entering column names within double quotes in the Formula prompt will generally yield better results. Example: "First_Name"

4. You can rephrase the prompt, or add more details till you get the required output. You can also click Customize, if you want to edit the generated formula.

5. Click Preview to see a preview of the changes made to the formula.
 
6. Click the Apply button to apply the transform.

Here are some sample prompts for you to try out Formula Generator

 
Here are a few examples using natural language formula prompt.

a) I want to know if the ordered date is a weekday or it was on the weekend to assess when I get maximum orders. Here's the snapshot of the natural language prompt and the auto-generated formula.




b) I wish to get the average cost based on each month the order was received. Here's the snapshot of the natural language prompt and the auto-generated formula.

      


c) I want to mask credit card information and view only the last 4 digits of it. Here's the snapshot of the natural language prompt and the auto-generated formula. 



d) I want to update the Mobile number of a lead in my CRM sales data. Here's the snapshot of the natural language prompt and the auto-generated formula.


 

e) I want to find if a year is a leap year or not in my Sales dataset. Here's the snapshot of the natural language prompt and the auto-generated formula.


To apply filters

If you want to apply some filters along with this transform, you can use the filters functionality.

1. Click the Filters tab.

2. Click the   icon and add the required columns in the  Filters  section. You can also reorder the filters using the drag and drop method.



3. For every column added, you can select one of the following options from the drop-down:
  1. Actual: This option lets you filter rows based on the actual values in the column. Click here to know more.
  2. Data quality: This option lets you filter rows based on the quality of data in the column. Click here to know more.
  3. Patterns: This option helps you filter rows based on the data patterns in the selected column. Click here to know more.
  4. Seasonal: This option helps you filter rows based on the seasonal parameters such as quarter, month, week, etc. Click here to know more.
  5. Outliers: This option allows you to filter rows based on the outliers present in the data of the selected column. Click here to know more. 
Notes
Note: The filter options are displayed based on the datatype of the column added for the filter.

4. When you add more than one filter to the  Filters  section, the logical operators, AND or OR appear next to the filters. You can click to toggle the logical operator between AND and OR.
  1. Using the logical operators, you can combine the conditions and apply logic to determine the rule of precedence. The final expression is displayed in the  Criteria expression  box. You can click  Edit  to alter the default expression using logical operators and parenthesis to specify the precedence or the sequential order as to which condition should be evaluated first. Click  Save  after making the required changes. 
  1. For example, In the expression, ((1 OR 2) AND (3 OR 4)) , at first the condition ( 1 OR 2 ) will be executed and the condition ( 3 OR 4 ) will be executed next. Thirdly, since, the AND operator is used, the filter will be applied when both the conditions are true.
5. You can further drill down to choose specific values based on the filter option selected for each filter, in the next section.

     

For example, in the above screenshot, the Data quality option is selected for the All columns filter in the Filters section. Based on the selection, further options to filter specific values are displayed in the  All columns (Data quality) section.

6. You can choose to include or exclude the selected items in the last section.

7. If you want to remove all the filters for some reason, you can use the Clear button.

8. A live preview of the filter transform is shown as you make changes. 

9. Click the Apply button to apply the transform along with the filters.


SEE ALSO
Use window functions on a set of rows
How to enable features powered by OpenAI ChatGPT