用折线图中的不同列表示2个不同指标

时间:2020-08-03 17:59:10

标签: google-data-studio

我正在准备一个数据工作室报告。数据工作室报告由以下几列组成:

enter image description here

如图所示,它在特定的时间捕获指标数据。

The date range is set as the end_time

X轴表示 end_time 列,细分维度为 InstanceName 列,我正准备将其显示为折线图。

There are 2 metrics 重新阅读 writeops 列。

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.

我不确定如何在Data Studio上表示这一点。如果它是1指标,我知道这很简单。我可以将实例名称设置为细分维度,将 end_time 设置为维度,并将日期范围设置为end_time并可以表示它。但是要将2个指标表示为特定实例的2条不同线,并在x轴上显示时间范围,我不知道,因为我对datastudio非常陌生。我想不进行深入研究。类似于我从Google云控制台获得的下图,其中在红色中为 WriteBytes 显示了 ReadBytes 大三角形和底部的较小三角形。 enter image description here 谁能帮我?谢谢

1 个答案:

答案 0 :(得分:1)

根据需要如何显示图表有两种方法:

1)Filter Control

如果目标是仅显示2行(2个指标):

  • readops
  • writeops

在允许用户选择所需的InstanceName的同时,可以使用过滤器控件(可选,具有默认选项)。

该图表将使用:

  • 维度 end_time
  • 指标#1 readops
  • 指标#2 writeops

Editable Google Data Studio Report和一个用于扩展上述内容的GIF:

2)多个指标

如果目标是为每个InstanceName值以及两个指标(readopswriteops)显示一行,那么下面的方法将是一种方法。

当前,当使用“细分维度”时,Google Data Studio图表(例如Time Series图表)仅支持一个指标。

根据问题(Editable Google Sheets)中的屏幕截图,使用以下数据集:

一种方法是在数据源上创建和使用多个CASE语句;例如:

  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

等...

Editable Google Data Studio Data Source和一张精美图片:

然后可以使用end_time作为维并使用新创建的度量标准来创建统计图; Editable Google Data Studio Report和要通过Time Series图表显示的图像: