【问题标题】:How can I show zeros count?如何显示零计数?
【发布时间】:2022-04-05 03:15:12
【问题描述】:

我正在准备一份报告,其中包含一些地点数据以及工作人员列表访问这些地点的次数。也就是说,每个人都必须在一周内访问多个地方。我需要显示人员列表、地点并计算一周的总访问量。

我有两个数据库,第一个包含负责人和地点。在另一个中,我有访问历史,访问的人在哪里,星期和地点。

但是,我想显示在特定一周内仍有待访问的地方。但由于历史数据库中没有数据,Google Data Studio 没有显示任何内容,我需要它来显示地点、星期和零。

我尝试合并这两个数据库,但找不到解决方案。星期是数字,其他是文本。

表 1:visits_history

Personal Station Week
Person1 Portal Américas 30
Person1 Portal Américas 30
Person1 MOVIL 1 30
Person1 MOVIL 1 30
Person1 Portal Américas 30
Person1 Portal Américas 30
Person1 Portal Américas 30
Person1 Portal Américas 30
Person1 Portal Américas 30
Person1 Portal Américas 30
Person1 Portal Américas 30
Person1 Portal Américas 30
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Eldorado 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 MOVIL 3 31
Person1 MOVIL 3 31
Person1 Banderas P. Central 31
Person1 Banderas P. Central 31
Person1 Banderas P. Central 31
Person1 Banderas P. Central 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Américas 31
Person1 Portal Américas 31

表 2:visits_to_do_per_week

Supervisor Punto
Person1 Banderas P. Central
Person1 Centro Comercial Gran Plaza Soacha
Person1 Centro Comercial Hayuelos
Person1 Centro Comercial Milenio Plaza
Person1 Movil 1
Person1 Movil 2
Person1 Movil 3
Person1 Portal Américas
Person1 Portal Sur
Person1 Super Cade Bosa
Person1 Zona Franca

预期结果:

person station_asigment visits in the week
Person1 Banderas P. Central 1
Person1 Centro Comercial Gran Plaza Soacha 0
Person1 Centro Comercial Hayuelos 0
Person1 Centro Comercial Milenio Plaza 0
Person1 Movil 1 1
Person1 Movil 2 1
Person1 Movil 3 2
Person1 Portal Américas 1
Person1 Portal Sur 2
Person1 Super Cade Bosa 3

Editable Data Set (Google Sheets)

【问题讨论】:

    标签: google-data-studio


    【解决方案1】:

    假设visted 表为:

    week person visited
    35 Alice Paris
    35 Bob Paris
    35 Bob New York
    36 Alice Paris

    task 表是:

    person place
    Alice Paris
    Alice Berlin
    Alice Amsterdam
    Bob Paris
    Bob New York
    Bob Chicago
    Claire Los Angeles

    案例 1

    我假设每周都必须访问相同的地方。

    在 Data Studio 中,在 visited 表中创建一个滑块参数 week_select 以选择一周。然后用

    创建一个字段
    week - week_select
    

    在该字段为零的表上创建一个过滤器。

    混合数据集:

    添加带有personplace 的表格图表,然后在Metric 下的蓝色加号按钮上单击两次:

    然后用公式添加一个度量字段visited

    case when Record Count is null then 0 else 1 end
    

    你最终得到了那个

    案例 2task 表中还有一个星期列。

    因此,每周必须访问其他地方。那么就不需要添加参数和星期公式和它的过滤器了。

    【讨论】:

    • 感谢您的反馈。我尝试像您一样构建,但我无法制作 week_select 指标。这是一个数据示例 [链接到 Google 电子表格] (docs.google.com/spreadsheets/d/…) 你能帮我举个例子吗?
    • 首先您需要添加一个参数week_select 作为数字(整数),范围为 0 到 54。然后添加一个滑块并将此参数添加到其中。然后您可以选择要分析的具体星期。
    猜你喜欢
    • 2015-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-20
    • 1970-01-01
    相关资源
    最近更新 更多