How can I transform multiple columns at once?

Mirjam Schuke
Mirjam Schuke Administrator

This questions had been asked by a user of Data Studio so I'm posting it here for anyone else looking for advice on something similar:

I'm building a reusable workflow that outputs the counts of each value in the selected column(s), an example input and output is below.

Input:

Output:

To get the output in the format I want, I've used Group followed by a Rows to Column step, however this method only works for a single column at a time. In this example I've got the counts for each value of 'Store Number', but I also want the counts for each value of 'Customer Segment'. 

Is there a way of performing this transformation, or any transformation that requires a sequence of steps, on multiple columns, without having multiple copies of the step sequence? Perhaps some form of looping functionality?

Best Answer

  • Mirjam Schuke
    Mirjam Schuke Administrator
    Answer ✓

    If you add a Columns to Rows step before the Group, you can get all the values (for both store numbers and customer segments) in the same column, and then group on that (plus the extra 'column name' column added by the Columns to Rows step). If I've understood correctly that'll give you what you're looking for I think.