How can I use grouping to sort my data by two columns?

We all know that there is a group action that we can use to return one unique instance.  However, sometimes you might have the use case where you want to group by two different columns. 

In this example, the columns called date and campaign are grouped.

The underlying data in this example has multiple rows for each day and campaign combination.  

If we group on the day column we get the total impressions for each day but no information about the individual campaigns.

If, instead, we group by campaign we get the total impressions for each campaign but without the breakdown by day.

To get the breakdown by day and campaign combined we can add hidden data and use the CONCAT function to combine the two columns.

E.g. Assuming the dates are in column A and the campaigns are in column B of your  data the formula looks like

Add the group action to this data and it will group all unique date/campaign combinations.

In the visible columns make sure to set the aggregation for the date and campaign columns to “First” and this will display the text value for these. For the impressions aggregation use the default of sum.

1 comment

  • 0
    Yq Wu

    Very helpful!

Please sign in to leave a comment.