Data Studio
5.1K members online now
5.1K members online now
Ask questions about Data Studio
Guide Me
star_border
Reply

Cast a Metric by Dimension in Calculated Field

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Is there a way to "cast" a Metric by a Dimension? This is a global report want of mine. Here is a simple example I created to show the question:

 

Page      Gender      Pageviews      Total Pageviews     % of Total Pageviews

 

Data Studio generates a table line by line. It "casts" each value like Pageviews based on the inherited Metrics in this case Page and Gender. There is no way to know in the report line for home page female pageviews how many male home page views there were. Is there a way with a formula to calculate the global value of things and not be limited to the inherited Dimensions of the report? Something like:

 

TotalPageviews = Page(Pageviews)

 

Similarly if I wanted to add goal or event completion columns, I would want to know information about the global count to show how it compares to each line as it is calculated/rendered.

 

Thank you in advance for your help!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Marked as Best Answer.
Solution
Accepted by topic author Ron F
May 2017

Cast a Metric by Dimension in Calculated Field

Explorer ✭ ✭ ☆
# 4
Explorer ✭ ✭ ☆

Yes you are right, charts tables are governing by the dimensions associated. Metrics are following dimensions.

 

You can create a calculated field Total pageviews with the formula :

SUM(Pageviews)

But the problem is that you will have the sum of pageviews for each row and NOT the total views for the targeted page. 

So you can't do the comparaison. In this way you can't have a % field to know the parts if tablets/mobile/deskstop.

 

If you don't have many pages in your site, you can add the page dimension as a filter in the chart. 

For example, you can do : 

A pie chart, dimension "device category" and for the metrics "pageviews" and you created a filter in the chart : 

inclure "Page" contains "homepage" => your pie chart will give the % by device for your homepage

or "Page" contains "products" => your pie chart will give the % by device for all your pages "products"

 

Depends really about what you need to follow and how you want the best overview.

View solution in original post

Cast a Metric by Dimension in Calculated Field

Explorer ✭ ✭ ☆
# 2
Explorer ✭ ✭ ☆

Hi @Ron F

i need more precisions about your data source. Which kind of data source is it ? GA, Sheets...?

In Data Studio, you can create differents calculated fields, just be sure to set the logical goal that you want for each others.

 

Do you have this 4 fields below in your data source ? : 
Page      Gender      Pageviews      Total Pageviews     % of Total Pageviews

 

Do you have an example with 4 or 5 records about which table that you have and which table that you want to do ?

It will help very much !

Cast a Metric by Dimension in Calculated Field

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Patrick,

 

Thank you for the quick reply!

 

My data source is Google Analytics.

 

This example is my attempt to demonstrate the larger question I have. Every table in Data Studio has an associated Dimension or Dimensions with it. Those govern how the data is populated into the table. If I use Device Category as the Dimension for my report it will have three lines (mobile, desktop, and tablet). If I have Pageviews as a column, report line 1 will be the Pageviews for mobile, line 2 will be the desktop Pageviews, and line 3 will be the tablet Pageviews. My question is how on line 2 do I get access to the constant of total Pageviews for the site? I want the top level numbers, and then be able to report how each line in the report relates to the top line numbers.

Marked as Best Answer.
Solution
Accepted by topic author Ron F
May 2017

Cast a Metric by Dimension in Calculated Field

Explorer ✭ ✭ ☆
# 4
Explorer ✭ ✭ ☆

Yes you are right, charts tables are governing by the dimensions associated. Metrics are following dimensions.

 

You can create a calculated field Total pageviews with the formula :

SUM(Pageviews)

But the problem is that you will have the sum of pageviews for each row and NOT the total views for the targeted page. 

So you can't do the comparaison. In this way you can't have a % field to know the parts if tablets/mobile/deskstop.

 

If you don't have many pages in your site, you can add the page dimension as a filter in the chart. 

For example, you can do : 

A pie chart, dimension "device category" and for the metrics "pageviews" and you created a filter in the chart : 

inclure "Page" contains "homepage" => your pie chart will give the % by device for your homepage

or "Page" contains "products" => your pie chart will give the % by device for all your pages "products"

 

Depends really about what you need to follow and how you want the best overview.

Cast a Metric by Dimension in Calculated Field

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Thank you for your help with this Patrick!