I’m trying to calculate the percentage of total page views (% of Total Views) for each page in my Looker Studio report using data from GA4. The available metrics are Views, Views per Session, and Views per User.
I’ve tried creating a calculated field with the formula:
Views / SUM(Views) * 100
However, I’m getting an 'Invalid formula' error. What is the best way to calculate % of Total Views directly in Looker Studio, or should I use a blended data source? If blending is required, how do I set that up properly to include total views across all pages?
Hi @chadro, thanks for your post!
If Views is a metric, that means that it is already aggregated data - per the SUM function documentation, SUM cannot be used on an aggregated field, or on the result of an aggregation function. I think that's why you might be seeing the 'invalid formula' error.
What you can do is edit the Views metric on the chart, click the Comparison calculation menu, and then select the Percent of total comparison calculation option. The Add comparison metrics and running totals page has more detailed instructions and examples
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 |