Skip to content

Calculated Columns

Calculated columns in Infoveave allow you to create new data columns based on existing data. By using JavaScript, you can perform complex transformations and cleaning of column values directly within Infoveave, enabling you to manipulate and refine your data to meet specific analysis needs.

Configure Calculated Columns

Here is a step-by-step guide on how to configure calculated columns in Infoveave

  1. Choose the data table where you want to add a calculated column. Add Calculated Columns
  2. To add calculated column, click on the Add Calculated Column option at the top of the data table.The Add Calculated Column module will open up.
  3. Start by entering the name for the calculated column.
  4. Select the appropriate column type
  5. Enter the required formula or JavaScript code. Use (@) to refer to a column from the source.
  6. Click on Validate to preview the new column.
  7. Checkbox the Recalculate on Add option for the table to instantly validate the expression and add values to the new column.Enabling the checkbox will avoid the need of reuploading the data to add values to the calculated columns. Calculated Columns
  8. Click on Add Column to finalize and add the calculated column to your data table.

Scenarios

  • Change Column Format
  • In data analysis, it is required to change the column format of the data to suit specific requirements or fit certain rules. With Infoveave, you can easily accomplish this using calculated columns, where we can use custom JavaScript to make transform data. In this tutorial, we will learn to add an alphabet as prefix to numeric values in a column.
  • Example Let us consider the previously provided dataset containing sales information, including a “Customer ID” column with numeric values representing unique customer identifiers. In this example, we will add the alphabet “A” to each “Customer ID” value to create a new identifier format.
  • JavaScript Code
let customerID = @Customer ID; // Get the value of the Customer ID column
let newCustomerID = 'A' + customerID.toString(); // Concatenate 'A' with the Customer ID and convert to string
newCustomerID; // Return the new Customer ID
  • Replace Nulls
  • In data preparation for analysis, it is common to encounter missing or null values that can affect the accuracy of insights. Addressing these gaps is crucial for meaningful analysis. Infoveave provides tools to handle such scenarios efficiently. In this tutorial, we will explore how to replace null values with a specified text, like “Not available,” using calculated columns in Infoveave.
  • Example Consider a dataset containing customer information where some fields may have missing values. Let’s focus on the “Age” column and replace null values with “Not available.”
  • JavaScript Code
let age = @Age; // Replace 'Age' with the actual column name
if (age === null || age === "") {
age = "Not available"; // Replace null or empty values with "Not available"
}
age; // Return the modified value
  • Replace Column Values
  • In scenarios where you need to modify specific values in your dataset to align with updated information or new business requirements. With Infoveave’s calculated columns feature, you can easily achieve this by applying custom JavaScript code to manipulate your data. In this tutorial, we will learn how to replace specific values in a column using an example dataset where we want to update the dealer name “Sipes Group” to “New Spkies” due to a recent company merger.
  • Example Consider a dataset containing dealer information where some fields may have wrong values. Let’s focus on the “Dealer Name” column and replace the dealer name “Sipes Group” to “New Spkies”.
  • JavaScript Code
let dealerName = @Dealer Name; // Access the value of the "Dealer Name" column
// Check if the dealerName is "Sipes Group", replace with "New Spkies", else keep the original value
if (dealerName === "Sipes Group") {
dealerName = "New Spkies";
}
dealerName; // Return the modified value
  • Remove Timestamps from Date Columns
  • In data analysis, it is common that the date columns contain timestamps. In certain cases, you may need to remove the time stamp analysis or visualization. In this tutorial, we will demonstrate how to remove timestamps from date columns using Infoveave’s calculated columns feature. We will use an example dataset containing order information with timestamps and show how to extract and format the date portion only.
  • Example Consider a dataset containing order information with timestamps in the “Order Date” column. We want to remove the timestamps and display only the date portion.
  • JavaScript Code
var time = @Order Date;
var newTime = time ? time.split(" ")[0] : new Date().toISOString().split("T")[0];
var parts = newTime.split("-");
var formattedDate = parts[2] + "-" + parts[1] + "-" + parts[0];
formattedDate;
  • Add Conditional Filters
  • In data analysis, filtering data based on specific conditions is a common activity to focus on relevant subsets of data. With Infoveave, you can easily implement conditional filters using JavaScript code within calculated columns. This tutorial will demonstrate how to create a conditional filter to select rows based on a specific condition using the example of filtering customers older than 30 years old from the dataset.
  • Example Consider a dataset containing employee information with columns for “Employee Name” and “Age”. We want to filter out employees who are older than 30 years old.
  • JavaScript Code
var age = @Age;
if (age && age <= 30) {
true;
} else {
false;
}