Hello, I need help with my data model: I have two ...
# gooddata-cloud
m
Hello, I need help with my data model: I have two tables, each containing a "tag" column. This column has similar values in both tables, and I would like to create a single filter that applies to the data from both tables, but it shows me two separate filters. How can I merge them?
k
Looking at your LDM screenshot, I can see you have two separate datasets — Live metrics and Queue metrics — each with their own
Tag
attribute. That's why you see two separate
Tag
filters in the dashboard filter picker. To have a single
Tag
filter that applies to both datasets
, you need to extract
Tag
into a shared dimension dataset and reference it from both fact tables. Here's the approach: Solution: Create a Common Tag Dimension Dataset 1. Create a new
Tag
dimension dataset
in your LDM (mapped to a dedicated tag table or view in your database). 2. Remove the
Tag
attribute
from both
Live metrics
and
Queue metrics
datasets. 3. Create a relationship from the new
Tag
dimension dataset to each of the two fact datasets, using
Tag
as the primary key in the dimension and a foreign key in each fact table. [Create Relationships] Once both datasets reference the same
Tag
dimension, a single dashboard filter on
Tag
will apply to both. [Connections Between Datasets] > Important: For filters to work across datasets, the datasets must be logically connected in the LDM. As confirmed by GoodData support: "unless they are connected/joined in the data model, the filter does not apply." If the tables are in different data sources If
Live metrics
and
Queue metrics
come from different data sources, you can still use a shared dimension dataset — this is supported via the Multiple Data Sources in LDM feature. The shared
Tag
dimension must be present as a foreign key in each data source involved. [Multiple Data Sources] šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups. šŸ‘€ Our Support team monitors all messages and will jump in if needed.
m
@kapa.ai How to create the primary key and foreign?
k
Based on your use case (creating a shared
Tag
dimension linked to both
Live metrics
and
Queue metrics
), here's how to set up primary keys and foreign keys in GoodData: Setting a Primary Key 1. In the LDM Modeler, select your
Tag
dimension dataset. 2. Click … (ellipsis) → Set primary key. 3. Select the
Tag
attribute and click Set key. [Set Primary Key] Creating a Relationship (Foreign Key) Once the primary key is set on the
Tag
dimension, link it to each fact dataset: 1. In the LDM Modeler, locate the
Tag
dimension (originating dataset) and one of your fact datasets, e.g.
Live metrics
(target dataset). 2. Click the blue dot on the right border of the
Tag
dataset and drag the arrow to the
Live metrics
dataset. 3. In the dialog that opens: ā—¦ The primary key (
Tag
) from the originating dataset is shown on the left. ā—¦ In the Reference Field dropdown, choose: ā–ŖļøŽ Connect as new field — adds
Tag
as a new foreign key in
Live metrics
, or ā–ŖļøŽ Existing dataset fields — reuse the existing
Tag
attribute already in
Live metrics
and make it the foreign key reference. 4. Click Connect. 5. Repeat for the
Queue metrics
dataset. [Create Relationships] > Tip: When reusing the existing
Tag
column already present in your fact tables, choose Existing dataset fields in step 3 — this avoids adding a duplicate field and keeps your model clean. After saving, both
Live metrics
and
Queue metrics
will reference the same
Tag
dimension, and a single dashboard filter on
Tag
will apply to both. [Primary Key Concepts] šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups. šŸ‘€ Our Support team monitors all messages and will jump in if needed.
m
@kapa.ai do I need to create a view on my bigquery database ? Or only in the LDM?
k
Great question. Based on your situation, here's what you need to know: Do You Need a View in BigQuery? It depends on your data structure. Option A: Your
Tag
values already exist as a column in both tables
If the
Tag
column is already present in both
Live metrics
and
Queue metrics
tables in BigQuery, you do not necessarily need to create a new view. You can: • Create a
Tag
dimension dataset in the LDM only. • Map it to one of the existing tables (or a dedicated tag table if you have one). • Use Existing dataset fields when creating the relationship to reuse the
Tag
column already in each fact table as the foreign key. Option B: Multiple datasets mapped to the same table If you need to map multiple LDM datasets to the same BigQuery table, be aware that publishing an LDM with multiple datasets mapped to the same table will fail. In that case, you must create separate views in BigQuery for each logical dataset. [Advanced Modelling Use Cases] BigQuery-Specific Note BigQuery does not support referential integrity (primary and foreign keys at the database level). This means GoodData cannot auto-detect relationships from the database schema. You need to define primary keys and foreign keys manually in the LDM. [BigQuery Additional Info] In summary: For your use case, you likely only need to make changes in the LDM (no new BigQuery views required), unless you end up needing to map multiple LDM datasets to the exact same BigQuery table. šŸ‘ 0 button šŸ‘Ž 0 button ā„¹ļø Tip: Mention @kapa.ai in the thread for follow-ups. šŸ‘€ Our Support team monitors all messages and will jump in if needed.