representing 2 different metrics with different columns in line chart

|▌冷眼眸甩不掉的悲伤 提交于 2020-08-10 13:12:49

问题


I am preparing a datastudio report. The data studio report consists of the following columns below:

As seen in the picture it captures metric data at a particular time.

The date range is set as the end_time

The X axis will represent the end_time column and the breakdown dimension will be InstanceName column and I am preparing to show it as line chart.

There are 2 metrics readops and writeops columns.

I need to represent these 2 metrics as 2 different lines in the same chart so that the read and write operation fluctuations for the instance at a particular time can be easily viewed.

I am not sure on how to represent this on data studio. If it is 1 metrics, i know it is straight forward. I can set instancename as breakdown dimension and end_time as dimension and date range is set to end_time and can represent it. But to represent the 2 metrics as 2 different lines for a particular Instance, with the time range on x axis, i don't know as I am very new to datastudio. I want to do it without drill-down. similar to the picture below which I got from google cloud console which shows ReadBytes the Big Triangle and the smaller one at the bottom in red for WriteBytes Can anyone help me? Thanks


回答1:


There are two approaches based on how the the charts need to be displayed:

1) Filter Control

If the aim is to only display 2 lines (2 Metrics):

  • readops
  • writeops

While allowing the user to select the required InstanceName, then a Filter Control (optionally with a default selection) could be used.

The chart would be set up using:

  • Dimension: end_time
  • Metric #1: readops
  • Metric #2: writeops

Editable Google Data Studio Report and a GIF to expand on the above:

2) Multiple Metrics

If the objective is to display a line for each of the InstanceName values as well as both the Metrics (readops and writeops), then the below approach would be one way.

Currently, when using a Breakdown Dimension, Google Data Studio charts (such as a Time Series chart) support a single metric.

Using the Data Set below, based on the screenshot in the question (Editable Google Sheets):

One approach is to create and use multiple CASE statements at the Data Source; for example:

  1. readops_dum
CASE
  WHEN REGEXP_MATCH(InstanceName, "(dum)") THEN readops
  ELSE NULL
END
  1. writeops_dum
CASE
  WHEN REGEXP_MATCH(InstanceName, "(dum)") THEN writeops
  ELSE NULL
END

etc...

Editable Google Data Studio Data Source and an image to elaborate:

A Chart could then be created with end_time as the Dimension and using the newly created Metrics; Editable Google Data Studio Report and an image to visualise with a Time Series chart:



来源:https://stackoverflow.com/questions/63234605/representing-2-different-metrics-with-different-columns-in-line-chart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!