Skip to main content
In this part of the tutorial, you’ll aggregate and rank the joined data from part 2, write the result to another new table, and then link your orchestration and transformation pipelines so they run together.

Perform more transformations

Now that you’ve written your joined data into the SocialMediaOutput table, aggregate and rank it using some more transformation components. You’ll then create another new table containing this aggregated and ranked data.

Find the total likes per country using Aggregate

Use the Aggregate component to find the total number of likes for each country in your data set. In part 2, Join is already connected to a Rewrite Table component that writes the SocialMediaOutput table. The Aggregate component branches off the Join output, in parallel with that Rewrite Table component. You don’t need to insert it between them.
  1. In your JoinDataSets transformation pipeline, click the + icon to the right of the Join component to add a connected component.
  2. In the Add component dialog, search for and click the Aggregate component.
  3. In the properties panel, click the Groupings property, then select the checkbox next to Country.
  4. Click the Aggregations property. In Column Name, select Likes. In Aggregate Type, select Sum. Click Save.
  5. Validate the pipeline and sample your data.
Almost all your data disappears, leaving a data set containing the total number of likes for each country, in a new column called sum_Likes.

Rank countries by total number of likes using Rank

Sort your data using the Rank component, in descending order according to the total number of likes.
  1. Click the + icon to the right of the Aggregate component to add a connected component.
  2. In the Add component dialog, search for and click the Rank component.
  3. In the component properties panel, leave Partition data empty, so that the component ranks all countries together.
  4. Click the Ordering within partitions property and configure the ordering settings:
    • In Input Column, select sum_Likes.
    • In Ordering, select Descending.
    • Click Save.
  5. Click the Functions property and configure a function:
    • In Window Function, select Rank.
    • In Output Column, enter CountryRank.
    • Click Save.
  6. Validate the pipeline and sample your data.
Your data is now ranked in descending order by the number of total likes per country, and a new column contains each country’s rank. The country with the most likes has rank 1.

Write the transformed data to a new table using Rewrite Table

Create a table called RankedSocialMediaLikes containing this aggregated, ranked data. This table is separate from your SocialMediaOutput table, which contains all your posts and users data.
  1. Click the + icon to the right of the Rank component to add a connected component.
  2. In the Add component dialog, search for and click the Rewrite Table component.
  3. In the component properties panel, in Target table, enter RankedSocialMediaLikes.
  4. Validate the pipeline.
Your transformation pipeline is now finished. It’s a good idea to edit the names of your Rewrite Table components so that you know which tables they each write to. To rename a component, click the component, then click the edit icon next to the component name.

Automate these pipelines using And and Run Transformation

Link your LoadSocialMediaData orchestration pipeline to your JoinDataSets transformation pipeline, so that when you run the orchestration pipeline, it automatically runs the transformation pipeline. Use the And and Run Transformation components to do this.
  1. Open your LoadSocialMediaData orchestration pipeline.
  2. Click the + icon to the right of the Google Sheets component to add a connected component.
  3. In the Add component dialog, search for and click the And component.
  4. Click and drag the connection ring to the right of the Excel Load component to the And component.
  5. Click the + icon to the right of the And component to add a connected component.
  6. In the Add component dialog, search for and click the Run Transformation component.
  7. In the component properties panel, in Transformation pipeline, select SocialMediaData/JoinDataSets.
  8. Validate the pipeline.
  9. Run the pipeline.
When you run this orchestration pipeline, it runs both the LoadSocialMediaData and JoinDataSets pipelines. You only see the orchestration pipeline in the Task history tab at the bottom of the canvas. Click this task to open its details, then expand Run Transformation to see the steps of the transformation pipeline. The RankedSocialMediaLikes table contains one row for each country.

Next steps

You’ve built an orchestration pipeline and a transformation pipeline, and linked them together. To continue learning: