What are Calculations?

Calculations are mathematical and logical expressions that run on the data in your RLD Project to create new fields. Some examples are:

Imagine you created a form to track revenue, number of items produced, and money spent every day.
Using calculations would allow you to determine:

In the rest of this section we will cover how to make a few basic calculations.


Creating Basic Calculations

All the calculations will be based off of the getting started section Creating a Data Input App. If you are unsure what to do, go to that section first.

Number Calculation

Our first calculation will be really simple: We will take the number put into the slider and divide it by 100.

  1. To get started click + Add New Calculation
  2. Click where is says "Calc Name" and enter in "First Calculation"
  3. On the left sidebar under ▼Fields find Revenue, click and drag it into the white box next to our calculation name.
  4. On the right sidebar under ▼Basics find the divide symbol that looks like this divide symbol. Click and drag it to the right of Revenue
  5. On the right sidebar under ▼Basics find Number: that looks like this Number Constant. Click and drag it to the right of our divide.
  6. Click on the number inside your operation and change it to 100, then click enter to lock it in.

Number Calculation


Logic and Text Calculation

This calculation will check if the user entered "January" into our form.

  1. Click + Add New Calculation
  2. Name this calculation "January Entered"
  3. On the left sidebar under ▼Fields find Month, click and drag it into the white box next to our calculation name.
  4. On the right sidebar under ▼Basics find the == symbol that looks like this ==. Click and drag it to the right of Month
  5. On the right sidebar under ▼Basics find Text: that looks like this Number Constant. Click and drag it to the right of our ==.
  6. Click on the number inside your operation and change it to "January", then click enter to lock it in. **NOTE: the text constant is cas sensitive, so make sure you type exactly "January".

Text Calculation


Button Calculation

This calculations will count the number of times the submit button is pressed. We know that since this button submits our data it should only ever be 1.

  1. Click + Add New Calculation
  2. Name this calculation "Number of Submits"
  3. On the right sidebar under ▼Events find the COunt() function that looks like this ==. Click and drag it into the operations box.
  4. On the left sidebar under ▼Fields find Submit Button, click and drag it into the parentheses of the Count() function.

Button Calculation



Basics Group By Calculation

What is a Group By

This section will cover doing some basic calculations using a concept known as Group By.

Group By Allows you to do things like:

Anytime you see the word per in a description of a calculation it means it will need to use Group By.

Creating a Basic Group By Calculation

Our New Calculation

Our first group by calculation will be called "Average Revenue Per Month". It will give us the average revenue per unique month entered into the text input. So if someone entered the following data into our form:

- Revenue: 100, Month: January
- Revenue: 0, Month: January
- Revenue: 60, Month: February
- Revenue: 100, Month: February

Our calculation would give us back:

- Month: January, Average Revenue Per Month: 50
- Month: February, Average Revenue Per Month: 80

Creating Our New Calculation

To create a Group By calculation we need to create a new tab.

  1. Go to the top where it says "tab-1" and click the "+" button next to it.
  2. Enter in a name for the tab: "Group By Tab"
  3. On the left sidebar under ▼Fields find Month, click and drag it into the box that says GROUP BY
  4. Click + Add New Calculation
  5. Click where is says "Calc Name" and enter in "Average Per Text"
  6. On the right sidebar under ▼Events find the Average() function that looks like this ==. Click and drag it into the operations box.
  7. On the left sidebar under ▼Fields find Revenue, click and drag it into the parentheses of the Average() function.