Google Data Studio – How to Create a Row Level Calculated Field

google-data-studio

If my table looks like:

Date        Conversions Clicks
2020-02-10      2           20
2020-02-09      50          80

And I'd like to add a calculated field of Ratio (conversions/clicks), which should look like:

Date        Conversions Clicks      Ratio
2020-02-10      2           20      10%
2020-02-09      40          80      50%

But if I remove the Date dimension that it looks like:

Conversions Clicks      Ratio
    42          100     60%

When it should look like:

Conversions Clicks      Ratio
    42          100     42%

In other words, it sums up the original ratios instead of re-calculating them as a total.

What can be done to fix this situation?

Best Answer

Turns out calculated fields must be surrounded with SUM(), if you need them to adapt to grouping.

This way you can use any combination of dimensions and the calculated fields will adapt their calculations accordingly.

In other words, change Ratio from Conversions/Clicks into SUM(Conversions)/SUM(Clicks).