Creating calculated fields

Calculated fields are new fields that exist only in the Qlik Sense data model. They are derived from the data that has been loaded.

Using the Data manager, you can edit your table and add another field, which means you can derive more information about your data by editing the table structure. To add these fields, do the following:

  1. Go to the Data section and select your Orders table. After doing this, select the small pencil that signifies the edit button at the bottom:

  1. The following screen then appears: 

Let's discuss some options (please refer to Further reading section for a link to the entire documentation on table editing).

For each selected field, you can do the following:

  • Replace values: By using this option, you can change values into new values, and fix data quality issues, like mistypes values. An example of this is shown in the following screenshot:

  • Set nulls: By using this option, you can change values into nulls, which means the null values will not be shown on Qlik Sense. As we can see in the following screenshot, 10249 and 10248 will be replaced with null values:

As we can see in the following screenshot, we have some options for each field:

We have the following options:

  • Rename: As the name states, this merely allows you to rename the field
  • Associate: This allows you to associate this table with another table (we will focus on this later in this chapter, in the Table associations section)
  • Sort: This option helps sort the field values based on values from that field
  • Hide in Analysis: If this option is used, this field will not be displayed in Qlik Sense
  • View details: This is a shortcut to a screen that shows if this field is calculated or not

All of these options are related to existing fields, but we can create calculated fields using the Add field button that lies on the upper-right side of the screen. To do this, follow these steps: 

  1. Press Add field and then select Calculated field:

  1. A popup containing a form will appear, as follows: 

  1. Create a field called Processing Time that calculates the gap between the OrderDate and ShippedDate using a function called Interval that formats the gap time:

  1. To consolidate our new field, please press Load data on the upper-right of the screen. Our application will be refreshed and the field will be created in the data model:

Now, we have created a field that can be used in our application like any other that came from our original data file.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset