You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Looker中创建不含必填日期字段的新Explore?

在Looker中创建自定义Explore(移除必填日期筛选器并保留指定维度)

步骤1:定位原Explore的LookML代码

打开你的Looker项目,找到定义原Explore的Model文件(通常在models/目录下的.lkml文件),找到原Explore的代码块,示例如下:

explore: insights_original {
  view_name: insights
  required_filters: [insights.date_dimension]
  # 其他原配置内容
}

步骤2:复制并创建新Explore

在同一个Model文件内,复制原Explore的代码,修改Explore的名称(比如命名为insights_table),作为新Explore的基础:

explore: insights_table {
  view_name: insights
  # 后续添加自定义配置
}

步骤3:保留仅需的维度

使用fields参数明确指定要保留的维度/度量,避免继承原Explore的所有字段,示例如下(假设你需要保留user_id、product_name、revenue):

explore: insights_table {
  view_name: insights
  fields: [
    insights.user_id,
    insights.product_name,
    insights.revenue
    # 按需添加其他需要的字段
  ]
}

注:如果原Explore通过extends继承了其他配置,fields参数会覆盖继承的字段列表,只保留你指定的内容。

步骤4:移除必填日期筛选器

根据原必填筛选器的设置方式,选择对应操作:

  • 若原Explore通过required_filters参数设置日期维度为必填,直接删除该参数即可;
  • 若原insights.view中的日期维度本身标记了filter: required,只要在fields参数中不包含该日期维度,就不会出现对应的必填筛选器;
  • 若需要保留日期维度但取消必填,可在新Explore中重新定义该筛选器并覆盖必填属性:
explore: insights_table {
  view_name: insights
  fields: [
    insights.user_id,
    insights.product_name,
    insights.revenue,
    insights.date_dimension # 保留日期维度但取消必填
  ]
  filters: {
    field: insights.date_dimension
    required: no # 覆盖视图中的必填设置
  }
}

步骤5:保存并部署

保存修改后的LookML文件,提交并部署你的Looker项目。之后在Looker的Explore界面就能找到新创建的insights_table Explore,它只包含你指定的字段,且无必填日期筛选器。

内容的提问来源于stack exchange,提问作者Pandafreak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.06 16:10:33