How to?Create Computed Field

Why Use Computed Fields

Computed fields allow you to create new data from data that already exists. When you create a computed field, you are essentially creating a new field in your data source, the values or members of which are determined by a calculation that you control. This new computed field is saved in the chart, and your original data remains untouched.

You can use computed fields for many, many reasons:

  • To segment data
  • To convert the data type of a field, such as converting a string to a date
  • To aggregate data
  • To calculate ratios

Create a computed field

1. Click the “Add computed field” button in toolbar.

1.png

2. “Add computed field” will appear.

2.png

3. In the dialog, do the following:

- Enter a name for the computed field. In this example, the field is called Male to Female Population Ratio (%).

- Enter the SQL expression for the computed field. This example uses the following expression. It calculates the Male-to-Female population ratio, expressed as a percentage.

100 * CAST(pop_male AS FLOAT) / NULLIF(CAST(pop_female AS FLOAT), 0)
3.png

4. When finished, click Add. The new field is added to measure field because it returns a number.

4.png

Use a computed field in the view

1. Drag the ‘Male to Female Population Ratio (%)’ field to the X-axis and the ‘State’ field to the Y-axis.

5.png

2. Then, drag the ‘Male to Female Population Ratio (%)’ field to the Color shelf to visually differentiate the values.

6.png

3. Click on the three vertical dots next to the computed field to access additional options such as ‘Edit Computed Field’, ‘Rename Field’, or ‘Remove Field’.

7.png

© 2025 India Data Portal. All rights reserved

isb logo
bmgf logo
Copyright and Privacy Policy as applicable on IndiaDataPortal.com