Select Page

Mysql has a nice feature to group by a column and concatenate the corresponding values from another column.

This seems not possible to do with Google Data Studio.
Also a standard Excel software does not allow that, so I installed Power Query (free Excel addon).

Example:
We have a table around SEO keywords.
Each keyword as a traffic value and a url.

We want to group those keywords together and list the corresponding urls.

Below the code I used to implement my use case.

 

  1. After opening your Spreadsheet / Excel file and selected the table .. click “Power Query” => “From Table/Range”
  2. Click on “Group by”
  3. Construct a temporary query by filling in the Wizard.
  4. This generates a query / formula
    We will replace this with our custom one. See further

 

= Table.Group
(#”Changed Type”, {“Keyword”},
  {
     {“Traffic”, each List.Sum([Traffic]), type number},
     {“Entries”, each Table.RowCount(_), type number},
     {“number_of_flows”, each List.Count(List.Distinct([domain])), type number},
     {“URL’s”, each Text.Combine( [URL] , ” , “), type text}

  }
)

= Table.Group(#”Changed Type”, {“URL”},
{
{“Traffic”, each List.Sum([Traffic]), type number},
{“Entries”, each Table.RowCount(_), type number},
{“Keywords”, each Text.Combine( [Keyword] , “,”), type text}
}
)