When working with functions during Qlik Sense sheet building, it is essential to know about master items. Master items are a way to save a previously created dimension, measure, visualisation or state for future re-use. This article will cover the basics of master items, including:

  • How to create master items
  • How to use existing master items
  • How to edit master items
  • Tips for working with master items
  • Pros and cons of master items

Note that screenshots shown throughout the article may differ from your Qlik Sense due to the version and product differences.

How to create master items

Dimensions and measures

There are two ways to create dimension and measure master items. The first way is to save an existing measure or dimension as a master item. To do this, go to the visualisation properties of where the dimension or measure exists. Under the ‘Data’ property, open up the relevant dimension or measure. Scroll down to the bottom and click ‘Add new’ under the ‘Master item’ section. On the pop-up, fill in the relevant details and click ‘Create’.

The second way is to create a master dimension or measure from scratch, i.e. write the function during the creation process. To do this, open the sheet assets and click ‘Master items’. Click on either ‘Dimensions’ or ‘Measures’. Click ‘Create new’. In the resulting pop-up, fill in the relevant detail and click ‘Create’. Note that when we used method one, the ‘Field’ or ‘Expression’ boxes (depending on whether you are creating a dimension or measure) were already populated. Using this method, they are blank, so you have to add a function here.

Visualisations

There is only one way to create a master visualisation. First, you must create the visualisation you want to save in the ‘normal’ way. Then, right-click on it while still in sheet edit mode and click on the chainlink icon to save it as a master item. On the pop-up, fill in the relevant details and click ‘Add’.

Alternate states

Alternate states can only be created from the ‘Master items’ sheet assets. Within the section, click on ‘Alternate states’. Then, click ‘Create new’. Fill in the new state name on the pop-up and click ‘Create’.

How to use existing master items

Dimensions and measures

There are two ways to use existing master dimensions and measures in visualisations. Firstly, you can find the required master item in the list of master items and drag this onto a visualisation. On the options given, you can choose to ‘Add’ the master item to the visualisation.

The second way is to add the master item from the visualisation properties in the ‘Data’ section. Go to ‘Data’ and click to add a new dimension or measure. On the drop-down, at the top, you will see master items. If you are adding a dimension, the dimension master items will be under the title ‘Dimensions’. If you are adding a measure, the master measures will be under the title ‘Measures’. Click on the relevant one to add it to the visualisation.

Visualisations

To use a master visualisation, go to the ‘Visualisations’ section of the ‘Master items’ sheet assets. Then, drag the relevant visualisation onto the sheet.

Alternate states

How you use master alternate states will vary depending on how you are using the state. For example, suppose you are using the state to confine a whole visualisation to it. In that case, you will select the required state from a dropdown within either the ‘Add-ons’ or ‘Appearance’ property sections of the visualisation.

If you are using the state to focus a function, you will enter the state name within the function expression.

How to edit master items

Note: at the time of writing, if you are using Qlik Sense Enterprise on-premise or Windows, you will not be able to edit master items unless the app is in your workspace.

Note 2: you cannot edit an alternate state master item. Once you have created a state, if you need to change the state name, you must create a new state and delete the one with the incorrect name.

To edit a master dimension, measure or visualisation, find it in the ‘Master items’ sheet assets section, right click and choose ‘Edit’. Alternatively, you can find a visualisation in the sheet using the required master item and edit it from there. For visualisations, if you click on the master one in the sheet, the only option in the properties is to edit it.

For dimensions and measures, the option to edit the master item will be right at the bottom of the ‘Data’ property.

Tips for working with master items

Master items can be a great asset for developers and users. Here are some tips for getting the most out of master items:

  • Name vs Label: when creating a master item, note that for most, you can add a name and a label. The name is what you, the developer, see once the master item is created. The label is what the user sees when looking at the sheet. For example, imagine we are creating a master measure which calculates the last month’s sales. We may name the master measure ‘Last Month’s Sales’ so that every developer knows exactly what the measure shows. However, for the user, it’s cleaner to show the actual month when they look at the sheet, e.g. ‘April Sales’. This is precisely when you would use a label to give the measure a user-friendly name.
  • Clear naming: when you load data into the app, the fields may not be named in the most user-friendly way. For example, if you qualify tables, each data table’s name is added to the start of each field name. If users want to filter the app by a field not provided in the sheet, they may struggle to find what they need using the selections pane. Creating master dimensions allows you to rename fields with user-friendly names.
  • Drill-down dimensions: drill-down dimensions can only be created for master dimensions. They are a way to filter down ‘layer by layer’. Look out for drill-down options when creating a master dimension. For example, say your business trades internationally, and you have location customer data in Qlik. You could create a drill-down dimension that would, by default, show the country. Then, once a user clicks on a country to filter by it, the dimension changes and now shows the region within a country (county, state, etc.). Once a user clicks on a region, the dimension changes to show a city. This is how a drill-down dimension works.
  • Colours: when creating a master dimension or a measure, you can give it a colour. This means that whenever you use this dimension or measure in a visualisation, the colour will be consistent.
  • Segment colours: when creating a master measure, you can create segment colours. For example, if you have a measure that calculates the change in sales month on month, you can create a segment colour that is red if the sales are down and green if they are up. This creates a brilliant visual experience for the end user.
  • Master visualisations: master visualisations are especially useful for filter panes. Once you create one, you can save it as a master item and add it to each sheet in the app to keep the user interface consistent.
  • Alternative states: these can only be created as master items and give some powerful calculation options. I strongly suggest you take some time to learn about alternate states and how to use them in your apps.

Pros and cons of master items

Now that we have an understanding of what master items are, how to create them and how to use them, let’s talk about the pros and cons to them. This list should help you decide in what circumstances master items are useful to your business’s apps.

Pros

  • Efficient for editing: if you are using the same function throughout many sheets and visualisations, should you need to change something in this function, you would have to go through each one manually and make the change. However, if this function was saved as a master item and the master item was used in all those visualisations, you only need to change it in one place – the master item. This is significantly quicker and more accurate as it avoids accidentally missed manual updates.
  • Better user experience: the various customisation options available when creating master items can help provide a much cleaner user experience to the app’s users.
  • Quicker build: if your dimensions and measures require the same expressions, it is much quicker to write them once, save them and re-use them across all the relevant visualisations rather than writing each one.
  • Minimise errors: if your dimensions and measures require the same expressions, not writing them many times also reduces the likelihood of an error.

Cons

  • Confusion: if your app uses many measures and dimensions, the master items list soon becomes cluttered. You must be absolutely clear in the name/ label/ description of each master item what it is for to avoid confusion in the future, especially when other developers work on the app. In addition, if the app uses master items and has some functions directly in visualisations, this can be a source of confusion when making changes in the future. For example, a developer may assume all measures are master measures and miss important places changes must be made if they don’t double-check each visualisation.
  • Not always useful: master items aren’t always useful. For example, if you are using a visualisation only once, there is no need to add it to the master items list.
  • Not always the best choice: some master item elements, such as drill-down dimensions and segment colours, can be achieved using clever function combinations. Sometimes, you can get a lot more control using functions, so consider what the best solution is before implementing it.