What's new ⬇ Download Reportworq
⬇ Guide PDF

Hierarchies#

Early release. This feature is in early release, so its screens and behavior may change. Tell us what you think with Send feedback. See Early release features and Send feedback.

A hierarchy rolls the values of a field up into groups: sales reps into teams, markets into regions, products into product lines. You define it once on the data model, attach it to a field, and every crosstab or professional report that uses the field can show the groups with their subtotals. Because it lives in the model, it travels with the model when you copy, export or import it.

When to use it. Use a hierarchy when the source has the detail but not the grouping you report on, or when the grouping changes by report. At Timberline Harvest Co., the Sales Details view lists 36 products, each with a product_line. A Levels hierarchy of product up to product_line lets a crosstab show each product line with its products beneath, and the line totals stay correct as products are added. A grouping that exists only in your head, such as Domestic and International markets, is a Manual hierarchy.

Two kinds of hierarchy#

Manual Levels
You provide The members and how they roll up, typed as an indented outline A view of the model and the fields it rolls up through, most detailed first
Members come from What you typed The view's data, read each time a report uses the hierarchy
Stays current as data changes No, you edit the outline Yes
Best for A small, stable grouping that is not in the data A grouping that is already columns in a view

Before you start#

Create a Manual hierarchy#

  1. Open the data model, select Source in the rail, then the Hierarchies tab. It lists every hierarchy of the model with its Type, what it is Built from, its Size and the fields it is Attached to. An empty list reads No hierarchies yet.

  2. Select New hierarchy. The hierarchy opens on its own screen.

  3. Enter a Name. It must be unique within its source.

  4. Leave Type on Manual. If the model has several sources, choose the source under Built from; it cannot be changed after you save.

  5. Type the outline under Members: one member per line, indented two spaces or one tab for each level.

    Domestic
      USA - East
      USA - Central
      USA - West
    International
      Canada
      Mexico
      Germany
    

    A line with lines under it is a group; the editor's hint and preview call it a consolidation. A line with none is a leaf, and it must match a value of the field you attach the hierarchy to, spelled the same way.

  6. Check the tree that appears beside the outline. If the outline cannot be used, the preview reads Reports can't use this yet and lists each problem with its line number. Typical causes: a top-level line with nothing under it, a value listed twice (a value has one place), an indent that is not two spaces or one tab per level, or an indent that jumps more than one level at a time.

  7. Select Save hierarchy. You return to the list with a note, Updated “<name>” at hh:mm:ss. Save the data model to keep it.

  8. Select Save Changes to save the data model. Until then the hierarchy exists only in your editing session.

The hierarchy editor for a Manual hierarchy named Market groups. The outline Domestic and International is typed under Members, with the markets indented beneath each, and a live tree preview shows two groups.
The hierarchy editor for a Manual hierarchy named Market groups. The outline Domestic and International is typed under Members, with the markets indented beneath each, and a live tree preview shows two groups.Tap or click the image to view it full screen

Create a Levels hierarchy#

  1. On the Hierarchies tab, select New hierarchy and enter a Name.
  2. Set Type to Levels.
  3. Under View, choose the view to read. The list offers every view of every source in the model, except joined views. When the model has several sources, each entry shows its source in brackets, for example Sales Details (TransactionDetails).
  4. Under Levels, from the leaf up, choose a field for each level. The first row is the Leaf, the most detailed level: the values your report's field holds. The last row is the Top. For Product lines, the leaf is product and the top is product_line. Select Add a level above for another level, and use the arrows and the remove button to arrange them. A hierarchy needs at least two levels, and a field can be used only once.
  5. Select Preview tree. Reportworq reads the view as you have it in the editor (unsaved changes included, variables at their defaults) and shows the members, their counts, and anything the data says about them under What the data says.
  6. Select Save hierarchy, then Save Changes to save the data model.
The hierarchy editor for a Levels hierarchy named Product lines. The View is Sales Details, the levels product and product_line are listed from the leaf up, and the preview tree shows the product lines with their products.
The hierarchy editor for a Levels hierarchy named Product lines. The View is Sales Details, the levels product and product_line are listed from the leaf up, and the preview tree shows the product lines with their products.Tap or click the image to view it full screen

How a Levels hierarchy reads its view#

Attach a hierarchy to a field#

A hierarchy does nothing until it is attached to a field.

  1. Open a view of the hierarchy's source and select its Fields tab.
  2. In the Hierarchies column of the field, open the menu and tick the hierarchy. For a Levels hierarchy, attach it to its leaf field (product in the example), because the leaves are that field's values. Detach all removes every hierarchy from the field.
  3. Select Save Changes.
The Fields tab of the Sales Details view. The Hierarchies menu on the product field is open and shows Product lines ticked, with Detach all at the bottom.
The Fields tab of the Sales Details view. The Hierarchies menu on the product field is open and shows Product lines ticked, with Detach all at the bottom.Tap or click the image to view it full screen

Notes on attaching:

Where a hierarchy shows up#

Edit, move and delete#

Ask AI can propose hierarchies#

Ask AI on the Source screen can propose Levels hierarchies with its suggested views: a dedicated view of one table and its level columns, the levels leaf first, and the fields to attach it to. Add creates all of it unsaved in your editing session, exactly as if you had made it here. The assistant never writes SQL for a hierarchy's view. Preview the tree before you save, because the assistant does not compare leaf values with your field's values. See Data models.

Notes and limits#

Going deeper. To join sources first and group afterward, see Join views across sources. For the full tour of the Source screen, see Data models.

Feedback on this page

Comments, questions, requests, or something missing or unclear? Email us - the page you are on is filled in for you.

Email feedback on this page

Or write to support@reportworq.com directly.