Skip to main content

Create a Logical View for Your Semantic Model

Learning Objectives

After completing this unit, you’ll be able to:

  • Describe what a logical view is.
  • Create a join.
  • Create a union.

Explore Logical Views

A logical view is a data object that’s made up of multiple tables that are connected to each other via specific join types or via a union.

With logical views, you can enrich data objects while maintaining full control over how they’re connected to each other. Your business users can then query this enriched dataset like a regular data object without having to‌ understand the underlying objects. The logical view is a separate object within the semantic model, with its own fields and it’s queried separately as its own object by the query service. The logical view can be filtered and can be connected to other objects through relationships in the Semantic Model canvas.

There are two ways to combine tables in a logical view.

  • Join: Lets you get a comprehensive view of your data when data is distributed across multiple tables or datasets.
  • Union: Lets you combine multiple data model objects (DMO) into a unified view of organizational data.

Create a Logical View Using a Join

Create a logical view to connect data objects. When creating a logical view you first have to define the properties, then you select the data object for the logical view. ‌Next, you can create a join between the two objects so you can get a comprehensive view of the data when information is distributed across multiple tables or datasets. Within the logical view, you can define which join you would like to create between two data objects.

  • Left join: A left join returns all records from the left DMO and the matched records from the right DMO.
  • Inner join: An inner join returns all records that have matching values in two DMOs.
  • Right join: A right join returns all records from the right DMO and the matched records from the left DMO.
  • Outer join: An outer join, also called a full join, returns all records from both DMOs.

For more information about the types of joins and examples, see Salesforce Help: Using the Join Clause for Insights.

Let’s go back to our use case. Since Daniel is only interested in products that were purchased, he can create a Logical View to join Products and Sales, and create a new Purchased Products table and connect it to the other objects with relationships. Every time this Logical View is queried, this join is executed and Daniel only gets purchased products. Let’s see how to do this.

  1. In the Semantic Model Builder, from the New dropdown menu, select Logical View.
    Semantic Model Builder showing the New dropdown with Logical View.
  2. In the Create a Logical View window enter a unique name, API name, and optional description.
    Create a Logical View dialog.
  3. Click Save.
    Now you have to select the data object for the logical view. You can select either a DMO, DLO, or Calculated Insight. Select the Product data object. You can include all ‌of the fields, or select specific ones to include.
    Select a Data Object for the Logical View dialog.
  4. Click Save.
  5. To add a join, select the object, and then click the plus sign.
    Add Join dialog highlighted.
  6. From the dropdown menu, select Join Object.
  7. Select the object that you want to join and then click Save.
    Select a Data Object for the Logical View dialog with the sales object selected.
    You can only join one object at a time.
  8. After you select the data object, you need to select the join type and select which data object fields you want to join. For this case, select Left Join.
    Join panel open at the bottom of the screen.
  9. Under Select Matching Data Object Fields, click the plus sign and select the matching data objects for the logical view.
  10. Under the left object, search for the field name.
  11. Under the right object, search for the matching field name. In this case, connect Product and Sales, by Product ID.
    Join dialog with Choose Data Fields dialog highlighted.
  12. Click Add. After you add your fields, the bottom pane shows a preview of the logical view and a line connecting the two objects indicates that the join is successful.
    Semantic Model Builder with preview of joined objects.
  13. Click Apply.

The logical view is added to your semantic model and appears with its own icon as follows.Semantic Model Builder with created logical view highlighted.

You can now create a relationship between the logical view and the other tables in your semantic model.

Create a Logical View Using a Union

In data analysis, it's often necessary to combine multiple tables into one. Unions make this easy. They allow you to seamlessly integrate data from different sources, so you can create a comprehensive view of your data. You can use unions to combine data model objects (DMOs) into a logical table, which you can then use for any business purpose. This view is created by appending values from one object to another, resulting in a comprehensive dataset that integrates information across sources.

Combining datasets with similar structures can be a powerful way to get a more comprehensive view of your data. By merging data through a logical view, you can improve reporting processes and gain insights that span multiple areas of your business. Often, different tables have one or more dimensions in common.

For example, one table might contain information about sales employee performance, while another table stores transaction data. Both tables might share a key aspect: a column representing the time of occurrence, typically in date format. To simplify analysis, business users often want to combine these shared columns from different tables as if they were one. This makes it easier to group, filter, and manage this data together, as it essentially represents the same information.

Daniel doesn't need a union for his data, but unions can be a great solution when you have many tables. For example, if you have marketing data, you have three different tables that show different types of marketing engagement: email, messaging, and website. You want one table that shows all three channels together, so common fields are combined.

  1. In the Semantic Model Builder Canvas, click the plus sign next to the data model object and then select Create Union.
    Add dropdown showing the Create Union option.
  2. In the Select Data Objects for Union dialog, select the first object for the union and then click Save. You can select up to nine objects. The merged fields in the union receive metadata from the first added object.
    Select Data Objects for Union dialog with list of objects.
    A preview of the selected object and fields appears.
    Data Model Object preview of fields.
  3. When all sets have been added, click Apply to add the new union to the logical view.

The union appears in the Semantic Model Builder Canvas.

Semantic Model Builder with Union highlighted in the canvas.

In this unit, you learned about what logical views are, the different use cases, how to create a logical view with a union, and how to create a join. In the next unit, you learn about the different ways you can create calculated fields in your semantic model.

Salesforce ヘルプで Trailhead のフィードバックを共有してください。

Trailhead についての感想をお聞かせください。[Salesforce ヘルプ] サイトから新しいフィードバックフォームにいつでもアクセスできるようになりました。

詳細はこちら フィードバックの共有に進む