Introduction
This tutorial is a continuation on the previous post on the three types of macros in Alteryx. Here we will focus on the first type – the standard macro. To recap, a standard macro in Alteryx allows you to encapsulate workflows into reusable components to improve efficiency, remove redundancy, and allow for standardisation.
In this tutorial, we will create a standard macro that calculates the engagement ratio (likes + dislikes per view) for different categories of YouTube videos.
Step 1: Load the Dataset
Download the dataset from this link and import the youtube_2005.csv file using the Input Data tool.
The file contains the following seven columns:
- Rank: the ranking within the top 1000.
- Video: the videos title.
- Video views: how many views the video received.
- Likes: how many likes the video received.
- Dislikes: how many dislikes the video received (2021 and prior).
- Category: the category of the video.
- Published: the year the video was published.
Step 2: Select the Fields and Convert Data Types
Use the Data Cleansing tool to remove the punctuation from the Video views, Likes, and Dislikes columns.
For this macro we will use the Category, Video views, Likes, Dislikes and Published columns.
Use the select tool to select the previously mentioned fields. Additionally, change the datatypes for Video views, Likes, and Dislikes to Double.
Step 3: Calculate Engagement Ratio for each Category
Use the Summarize tool to group by Category and sum the Likes, Dislikes, Video Views, and take the min of Year.
Use the Formula tool to create a new field called “Engagement Ratio”. The calculation will be:
([Likes] + [Dislikes]) / [Video views]
Optionally, sort the Engagement Ratio field to see the best performers using the sort tool. The workflow should look similar to the following.

Step 4: Convert to Macro
To convert this workflow into a standard macro right-click on the Input Data tool and select Convert To Macro Input.

Do the same for the Browse tool.

If these steps were successful, you will see the Workflow Configuration Type automatically changes to a Standard Macro.

Save the newly created Standard Macro as EngagementRatio.yxmc.
Step 5: Use the Macro in a New Workflow
Open a new workflow and import the youtube_2021.csv file using the Import Data tool.
Now right-click on the canvas and select Insert –> Macro and then select the newly created EngagementMacro.

Add a Browse Tool to the output anchor of the macro.

Run the workflow and discover which category had the highest engagement ratio in 2021.
Conclusion
In this tutorial we worked through the process of creating a standard macro in Alteryx. Additionally, we used the macro in a new workflow to test its functionality. In the next post we work through the process of creating and using batch macros.