Work with Data Models

The Data Model diagram helps you to quickly and easily define datasets, break groups, and totals for a report based on multiple datasets.

About Multipart Unrelated Datasets

If you don't link the datasets (or queries), the data engine produces a multipart unrelated query dataset.

For example, in the data model, image shown below, one query selects products and another selects customers. There's no relationship between the products and customers.

The result is shown in the data structure as depicted in the following image.

About Multipart Related Datasets

Data fetched for one part of a dataset or query can be determined by the data fetched for another part. The result is often called a master/detail, or parent/child relationship that's defined with a data link between two datasets or queries.

When you run a master/detail data model, each row of the master (or parent) query executes a query against the detail (or child) to retrieve only matching rows.

In the example, image below, two datasets are linked by the element Customer ID. The Orders dataset is a child of the Customers dataset.

The example produces the data structure shown in the following image.

Guidelines for Working with Datasets

Certain guidelines are recommended for building data models.

  • Reduce the number of datasets or queries in your data model as much as possible. In general, the fewer datasets and queries you have, the faster your data model will run. While multi-query data models are often easier to understand, single-query data models tend to execute more quickly. It's important to understand that in parent-child queries, for every parent, the child query is executed.

  • You should only use multi-query data models in the following scenarios:

    • To perform functions that the query type, such as a SQL query, doesn't support directly.

    • To support complex views, for example, distributed queries or GROUP BY queries.

    • To simulate a view when you don't have or want to use a view.