Unit introduction
You are now at the second unit of the “An Introduction to Aggregators” course within Make Basics.
In the previous unit you learned about the aggregators in Make.
In this course you will continue your aggregator journey and you will learn about how to use aggregators in practice. More specifically, you will build a scenario using the numeric aggregator!
So let’s start, shall we?
Numeric aggregator
The numeric aggregator is a powerful tool that allows you to perform various operations on numerical data from multiple sources. Here are some real-life use cases where you can use the numeric aggregator in Make.
Time tracking
It might be useful to use numeric aggregator to aggregate time tracking entries to do a performance report or generate an invoice.
This could help you get a better idea of how much time you are spending on various projects and tasks. Also, it could save your time when generating invoices for your services.
Social media monitoring
If you are monitoring social media mentions of your brand, you can use the numerical aggregator to calculate the number of mentions, likes, shares, and comments across different platforms.
This can help you to understand the level of engagement your brand is receiving on social media and help you make decisions to improve your social media strategy.
E-commerce
If you are selling goods or services online, you can use the numerical aggregator to aggregate information about your sales across countries, products, etc.
This could help you decide which products or services to focus on.
Inventory management
If you are a retailer, you can use the numerical aggregator to track inventory levels across multiple locations and warehouses.
This can help you to identify which products are selling well and which ones are not, and make decisions about when to restock or discount certain items.
Aggregate functions
Within the Tools → Numeric aggregator module in Make, there are a couple of aggregate functions that you can use.
AVG()
The AVG() aggregate function calculates the average value of all input values.
For instance, by using this aggregate function you can calculate the average salary for the employees who have less than 5 years of experience.
Note: You would need a filter before the aggregator for this type of use case.
SUM()
The SUM() aggregate function calculates the sum of all values per group.
For example, you can calculate the sum of your expenses, or the sum of the salaries you pay to your employees.
COUNT()
The COUNT() aggregate function returns the total number of items that match the specified criteria.
For instance, you can find the total number of employees who have less than 5 years of experience.
Note: You would need a filter before the aggregator for this type of use case.
MAX()
The MAX() aggregate function calculates the maximum value of all input values.
For example, you can find the biggest amount paid to your company.
MIN()
The MIN() aggregate function calculates the minimum value of all input values.
For instance, you can find the smallest value of the amount paid to your company.
Setting up
In this unit, you are going to create a scenario that gets the daily weather for 7 days, calculates the average maximum temperature for the week, and then sends this information to a spreadsheet.
To get started, let’s prepare the spreadsheet that you will use for this exercise. Work through each stage before you continue.
- Create a new Google Sheet and name it
Numeric Aggregator.Alternatively, if you have completed the exercise on the previous course, you could use the
Basic FunctionsGoogle Sheet. - Add a new sheet within it and name this
Numeric Aggregator. - In your
Numeric Aggregatorsheet, add the following headers:Date measuredAverage temperature for the week
That’s everything for now. You are all set and you can move on the next part of the exercise: you can start building a scenario again! Let’s get to it!
Use case with numeric aggregator
You are ready now and you can start building your scenario.
You are going to create a scenario that gets the daily weather for 7 days and then calculates the average maximum temperature and sends this information to a Google Sheet.
Let’s get to it!
Start by logging in to your Make account. Then click Create a new scenario.
Start your scenario by adding the Weather → Get daily weather forecast module. The purpose of this module is to get the forecast for the next 7 days for your location.
Weather Module Configuration
Under Days, tick the following:
- Today
- Tomorrow
- The day after tomorrow
-
- days from today
-
- days from today
-
- days from today
-
- days from today
Enter your location. We have “Madrid, ES” but feel free to enter the location you want.
Click OK to save your changes.
Your source module (Weather → Get daily weather forecast) will function differently from what you might be used to. Rather than just generating 1 bundle with the current weather, it will collect the weather data for 7 days. This means that it will output 7 separate bundles.
Numeric Aggregator Module Configuration
You want to get the maximum average temperature for the week.
The next step is to add the aggregator that will sum up all those 7 bundles from the Weather module in 1 bundle.
Add Tools → Numeric aggregator.
For the Source Module, select Weather - Get daily weather forecast.
In the Aggregate function, select Average (AVG) from the dropdown menu.
In Value field, choose Temperature: Maximum. Save your changes by clicking OK.
Note: In this activity there is only one source module being used (The Weather). When using an aggregator it is really important that if you have multiple modules before the aggregator, then you select the correct source module. This will ensure that you are using the correct data.
Google Sheets Module Configuration
The final step is to send this information to a Google Sheet.
Add Google Sheets → Add a row module to your scenario.
Connect your Google account.
Under Choose a Drive, select My Drive.
Under Spreadsheet ID, select Use cases > Numeric Aggregator / Basics.
Under Sheet Name, select Numeric Aggregator.
Now it’s time to put what you already know into good use!
You will use the functions that you have learned in the previous course Transforming data using functions to change the date format and also the number format.
Under Values, map the following:
In Date measured (A) column, you want to get the date in your preferred format. For this you can use the formatDate() function. Our date formatting looks like formatDate(NOW; "DD.MM.YYYY") but you can choose whatever you prefer.
In the Avg temperature for the week (B) field, you want to map the result from the aggregator. This will be a number and you might want to format that number so that it has only 2 decimal points. You probably remember doing this in the previous course. Your mapping should look like formatNumber(2.result; 2; .).
Click OK to save your mappings.
Testing the Scenario
Now it’s time to test your scenario and check if it’s working properly. Click Run once.
Navigate to your Google spreadsheet and check the changes that happened there.
Your sheet should be populated with data, similar to what we got here on the image. Note that your data might differ depending on your location and date.
The numeric aggregator has taken 7 values of the maximum temperature, and aggregated them using a function that calculates the average.
Great job! Now you know how to use the numeric aggregator! You got one step further on your Make journey!