Automatic joins and hierarchies

Contents[Hide]

1. Overview

This article demonstrates how to use automatic joining and user hierarchies to combine related data together.

In keeping with the self-serve paradigm in Dundas BI, as you drag-and-drop items from the Explore window to the canvas, some things are done automatically to save you time, such as joining together columns from different tables.

A user hierarchy is a hierarchy that you set up before selecting it in a metric set, which can include multiple levels, and additional data made available as attributes. You can define one based on a data source or data cube, or the system can define one for you automatically based on existing data relationships. For more details about hierarchies, see Understanding the Dundas BI data model.

The Adventure Works 2014 database is used as an example.

Related video: Creating Custom Categorical Hierarchies

2. Automatic joins

This example begins with a table visualization like the one in the View data with a chart and drill down article, which displays OrderQty as a measure, and a date-time hierarchy on the Rows axis.

Table visualization
Table visualization

2.1. Display ProductID on Columns

In the Explore window, expand the data connector to find the table [Sales].[SalesOrderDetail], and expand it as well.

Drag the ProductID column onto Columns in the Data Analysis Panel.

Drag Product ID onto Columns
Drag Product ID onto Columns

The table visualization is reconfigured to additionally display Product IDs along the columns axis.

2.2. Replace ProductID with Name

Since showing product ID values is not very meaningful, find the [Production].[Product] table in the Explore window and expand it. Drag the Name column onto Columns in the Data Analysis Panel, replacing the ProductID column.

Drag the Name column onto the Product ID column
Drag the Name column onto the Product ID column

The table visualization is reconfigured to show product names on the columns axis instead of product IDs (in alphabetical order, by default).

Table shows product names on columns axis
Table shows product names on columns axis

Behind the scenes, Dundas BI created a system-defined relationship and performed an automatic join between the SalesOrderDetail and Product tables based on their common column, ProductID. For more details about relationships, see the article Add a relationship between tables.

You could choose to drag additional data from this table to take advantage of auto-joining, for example by dragging Color to Slicers in the Data Analysis Panel.

3. Hierarchies

Now we will create a hierarchy to help in exploring our data.

3.1. Create a Product hierarchy

Use the main menu to create a new user hierarchy, and choose a Standard hierarchy.

Create a new hierarchy
Create a new hierarchy

This opens the Hierarchy editor, which lets you define a hierarchy by dragging items from the Explore window or a data file from your desktop.

As an example, expand your data connector in the Explore window and find the [Production].[Product] table. Drag the table (or one of its columns) to the canvas.

Tip
You can also drag a data cube or one of its elements to the canvas.

Drag the Product table to the canvas
Drag the Product table to the canvas

An automatically-defined hierarchy Structure is displayed with a Preview to the right.

Hierarchy Structure and Preview
Hierarchy Structure and Preview

Under Structure, you can select levels and modify them or define more. The Preview lets you explore the resulting hierarchy as a set of members arranged in a tree view. The name of your new hierarchy is displayed in the status bar at the bottom.

In this example, three levels of a Product hierarchy have been automatically defined by Dundas BI. When you drag the Product table to the canvas, Dundas BI looks at existing relationships between the Product table and other tables in the database and constructs this multi-level hierarchy. 

Tip
If you want to define the levels yourself and don't want multiple levels created automatically, hold the Shift key while dropping your first data source. Only a single level will be created, and you can append or insert more.

Even if the hierarchy is auto-generated, you have the option of customizing it by selecting a level and using the options in the Configure Hierarchy Level popup.

Configure a hierarchy level
Configure a hierarchy level

3.2. Replace ProductID with Product hierarchy

Next, go back to the metric set from Section 2.

Instead of replacing the product IDs with a simple Name column, we will replace it with our new hierarchy: remove Name from under Columns and re-add ProductID in the Data Analysis Panel.

From the Explore window, drag the hierarchy you created onto ProductID to replace it.

Drag the Product hierarchy to Columns
Drag the Product hierarchy to Columns

The Columns axis of the table visualization now shows product categories, which you can expand to see product subcategories and products. Since the Name column was indicated as the Member Caption Source for the hierarchy, the captions are taken from the Name column of each hierarchy level.

Expandable product members
Expandable product members

4. Attributes

Attributes are optional additional details from your hierarchy's data source that automatically become available when using the hierarchy in a metric set.

4.1. Add attributes

To add attributes to our Product hierarchy, re-open it from the main menu. For this example, click to select the Product level to open its details.

Add an attribute
Add an attribute

Click Add Attribute in the Configure Hierarchy Level popup for each attribute that you want to add, and under Attributes, choose one of the columns from this level's data source. From our example data source, you can choose Color, Class, Size, Style, and others.

4.2. Select attributes

Navigate back to the metric set to select the attributes.

To have a better look at our products, we can click the x button next to ModifiedDate in the Data Analysis Panel to remove it, then drag ProductID from Columns to Rows in the Data Analysis Panel.

Move ProductID to Rows and click to add attributes
Move ProductID to Rows and click to add attributes

Next, we can click to add an attribute of the Product hierarchy.

List of Product hierarchy attributes
List of Product hierarchy attributes

Select an attribute from the list. Alternatively, you can find these attributes in the Attributes folder under the hierarchy in the Explore window, which you can then drag to add.

Since we added attributes to the Product level in our example, click to expand or right-click to change the level down to Product to see its attribute values.

Product hierarchy expanded down to Product level
Product hierarchy expanded down to Product level

Unlike regular hierarchies, attributes are known to describe the values of the hierarchy, so totals and expander buttons are unnecessary and will be left out automatically for the attribute when selected after your hierarchy.

If you choose to, you can also place an attribute before its hierarchy, or on its own. In this case, totals and expanding/collapsing work as they normally do for other hierarchies. The figure below shows the result of dragging to re-order Product Color first and displaying the Product level of the hierarchy afterward.

Attribute selected before its hierarchy
Attribute selected before its hierarchy

5. See also

 

Dundas Data Visualization, Inc.
500-250 Ferrand Drive
Toronto, ON, Canada
M3C 3G8

North America: 1.800.463.1492
International: 1.416.467.5100

Dundas Support Hours: 7am-6pm, ET, Mon-Fri