I have SEO data and need to create a Stacked Bar chart with it. I have Landing Pages (URLs) and I need to sort them into 4 categories.
- Categorize Landing pages into Top 1-3 Landing pages by clicks; same for 4-10, 11-20, 21-100.
- Then I need to create Stacked Bar chart with this view.
Sample chart attached below:
Need Month on X axis, Total view count on X axis.
I have generated Random Data here to create sample chart. hopefully it will be enough.
For a categorization of the grouped items, there has to be some preprocessing. Data Studio cannot do it.
Possible approaches can be done in BigQuery, Sheets (pivot). A route in Data Studio would be to do it by the
PERCENTILE
in combination with a self blend, obtaining the rank (e.g. first 10% of clicks) instead of the top visited sites.Since you added the tag "custom-visuals", here a way to do it by the VEGA LITE plugin.
First add the Community visualization "Vega/Vega Lite" to your report.
Add as dimension the
date
and theLanding page
, and the metrics are the sum of the clicks.The add following Vega Lite code in the style tab:
it can be also viewed and developed under: https://vega.github.io/editor/#/edited
In case you need the top groups by date and not globally, please use this version
This is a Vega Lite code:
TOPs
for these valuesTOPs
.TOPs
in the top groups (top 1-3, top 4-20, etc. and name itTOPid
)TOPid
defines the stacked plot. For testing please useTOPs
TOPs
is used, because theTOPid
are string names and thus not have the desired order