例如,基于 Google Analytics 国家/地区维度的控件会应用于网页上也使用 Google Analytics 数据源的所有组件,即使它们连接到不同的数据视图也是如此。这是因为所有 Google Analytics 数据源都具有相同的默认字段集。(请注意,Google Analytics 中的可选功能(例如增强型电子商务)会生成可能不存在于所有 Google Analytics 数据源中的其他字段,因此与未启用这些功能的媒体资源或数据视图基于的控制不兼容。)
如果涉及的图表基于不同类型的数据源,即使字段具有相同的可见名称,跨数据源过滤通常也不起作用。这是因为过滤是基于内部字段 ID 进行的,而不是基于数据源中的可见字段名称。(在数据源中创建字段后,您将无法修改内部 ID。)
示例
假设您有一个报告包含 3 个不同的数据源:一个来自 Google 表格,两个来自 Google Analytics。即使这三个数据源都包含一个显示名称为“国家/地区”的字段,但只有 Google Analytics 数据源具有相同的内部结构。Google Analytics 图表的控件可以使用任一数据源中的国家/地区维度,但不会过滤 Google 表格图表。反之,基于 Google 表格中的国家/地区维度创建的控件会过滤基于 Google 表格的图表,但不会影响 Google Analytics 图表。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-31。"],[],[],null,["# Use controls across data sources\n\nIn a report based on a single data source, a control affects all the charts and other controls in the report. In reports with multiple data sources, how the control works depends on the data sources involved.\n\nAs a general rule, controls can filter charts from different data sources as long as the data sources share the same internal structure (schema). In practice, this means that you can filter across data sources if:\n\na) the data sources were created using the same [connector](/looker/docs/studio/connector), and\n\nb) the data sources have a fixed schema, with a predefined set of fields.\n\nFor example, a control based on the Google Analytics *Country* dimension applies to all components on the page that also use a Google Analytics data source, even if they connect to different views. This is because all Analytics data sources have the same default field set. (Note that optional features in Analytics, such as Enhanced Ecommerce, will produce additional fields that may not exist in all Analytics data sources, and therefore, not be compatible with controls based on properties or views without those features.)\n\nFiltering across data sources generally won't work if the charts involved are based on data sources of different types, even if the fields have the same visible name. This is because filtering is based on the *internal* field IDs, not the visible field names in the data source. (And, once a field has been created in the data source, you can't edit the internal ID.)\n\nExample\n-------\n\nSay you have a report with 3 different data sources: one from Google Sheets, and two from Analytics. Even if all three data sources include a field with the visible name of \"Country,\" only the Analytics data sources share the same internal structure. A control for the Analytics charts can use the *Country* dimension from either data source, but it won't filter the Google Sheets chart. Conversely, a control based on the Sheets *Country* dimension will filter the Sheets-based chart, but won't affect the Analytics charts."]]