问题
I would like to generate an easy daily percentage change of var
in Google Data Studio day-by-day as done below:
Basically, as shown in C4
, -65.31% indicates that from day 2 to day 3 there was a decrement of 65.31% of var
value and so on.
回答1:
Created a Google Data Studio Report to demonstrate as well as a GIF to elaborate on the process below (link to the respective GIF and Google Data Studio Forum Post).
1) dayPLUS1 (Calculated Field: Data Source-level)
Create a metric that adds 1 to the Day field:
day + 1
For YYYYMMDD
Date field calculations, use the formula below:
CAST(Date AS NUMBER )+1
2) Reaggregation (Self Blend)
Perform a self blend where the left Data Source includes values for the Day field and the respective metric, whilst the Data Source on the right includes the Day Plus 1 values:
Data Source 1
- Join Key: day
- Metric: var
Data Source 2
- Join Key: dayPLUS1
- Metric: varPLUS1
(rename the var metric)
3) Table (Blended Data Source)
Create a Table with the field to display the Daily Percentage Difference:
- Dimension: day
- Sort: day
in Ascending order
- Metric 1: var
- Metric 2 (Calculated Field; Type: Number > Percent):
(SUM(var) / SUM(varPLUS1)) - 1
来源:https://stackoverflow.com/questions/60693284/percentage-change-day-by-day-in-google-datastudio