Qlik Community

Qlik Design Blog

All about product and Qlik solutions: scripting, data modeling, visual design, extensions, best practices, etc.

Dimensions and Measures

To make a chart in QlikView – or in any Business Intelligence tool, for that matter – you need to know what Dimensions and Measures are. But not all people have a clear picture of the difference between the two. So this week’s post will try to straighten out what’s what.

When you make a chart, you should start by asking yourself “What do I want to show?” The answer is usually Sales, Quantity or some other number. This is your Measure. In QlikView we have traditionally called this an “Expression”, but "Measure" is really the correct word. (There are expressions that are not measures, e.g. expressions used as labels, or as sort order definitions).

 

The second question you should ask yourself is “How many times should this be calculated? Per what do I want to show this measure?” The answer could be once per Month, per Customer, per Supplier or something similar. This is your Dimension.

 

In the bar chart below, you have one bar per month, and a general rule is that you always have one data point per distinct dimensional value: But depending on which visualization form you have chosen, it can be a row (in a table), a point (in a scatter chart) or a slice (in a pie chart).

 

Bar chart.png

 

 

Measures

A database or a QlikView app can consist of thousands or millions of records that each contains a small piece of information. A Measure is simply a calculation that can be made over multiple records in this data set. The calculation always returns one single value that summarizes all relevant records. This type of calculation is called an aggregation. There are several aggregation functions: Sum(), Count(), Min(), Max(), etc.

 

Examples:

  • Each record contains a sales number. Then Sum(Sales) is a relevant measure that calculates the total sales value.
  • Each record represents an order and “OrderID” is the key. Then Count(OrderID) is a relevant measure that calculates the number of orders.

 

A Measure can be used almost anywhere in QlikView: In charts, in text boxes, as label for objects, in gauges, etc. Typical measures are all KPI:s, Revenue, Number of orders, Performance, Cost, Quantity, Gross Margin, etc.

 

Once again: A Measure is always based on an aggregation. Always!

 

 

Dimensions

Contrary to Measures, dimensions are descriptive attributes – typically textual fields or discrete numbers. A dimension is always an array of distinct values and the measure will be calculated once per element in the array.

 

Example:

  • The field “Customer” is used as dimension. The individual customers will then be listed and the measure will be calculated once per customer.

 

Typical dimensions are Customer, Product, Location, Supplier, Activity, Time, Color, Size, etc.

 

 

Like a For-Next loop

You can regard a chart like a For-Next loop: The Dimension is the loop variable; the calculations will be made once per dimensional value. So the Dimension determines how many rows/bars/points/slices the chart will have. The Measure is what is calculated in each loop.

 

 

Several Dimensions

If you have two or three dimensions in a chart, the dimensional values no longer form an array, but instead a matrix or a cube, where the measures are calculated once per cell in the cube.

 

Cube.png

 

 

SQL

You can also compare a chart with an SQL SELECT statement. The GROUP BY symbols are the dimensions and the aggregations are the Measures.

 

SELECT.png

 

With this, I hope that the difference between Dimensions and Measures is a little clearer.

 

HIC

15 Comments
maxim_senin
Contributor III

Henric, the description is perfect as usually! Thanks!

1st - why this is not a part of QV documentation?

2nd - one note regarding a nature of Dimensions in QV in comparison with those ones used in some OLAP solutions where the terms are used as well. In QV you can use a dimension not only as dimension but build your expressions (measures) with use of the dimension, e.g. as Henric mentioned above, we can count number of orders by Id - Count(OrderID). Some OLAP solutions only allow to perform a calculation over measures.

So if someone has OLAP background pay attention to this since QV is more flexible here.

Best regards,

Maxim

2,344 Views
Not applicable

it is very usefull for the final users, use the tags for 'dimensions' and 'measures', in the script.

So the final users are conducted on what fields to use when creating a chart

0 Likes
2,344 Views
Not applicable

Very helpful indeed.


Thanks!

0 Likes
2,344 Views
Not applicable

Cool, so is measure always the aggregated number? If yes what do you call the single data?  

0 Likes
2,344 Views

A measure is always an aggregation. But not necessarily a number. It could be a string.

What do you call the single data? Raw data? Transactional data?

HIC

0 Likes
2,344 Views
Not applicable

hmm, the tricky part is that it is relative, year based on month, based on week and so on. For a specific context, that is relative to the specific case the data is both "un-measure" and "un-dimensional"?  

Perhaps single data is just fine

0 Likes
2,344 Views
Not applicable

Fact data?

0 Likes
2,344 Views
Not applicable

dimesion =pk + reference data

fact = fk (primary key of dimension) + numerical data

2,344 Views
Not applicable

Wonderful information ,Thank you!!

0 Likes
2,344 Views
jonas_rezende
Valued Contributor

Excellent example with cube and SQL.

Congratulations!

0 Likes
2,344 Views
Chanty4u
Esteemed Contributor III

Nice post

0 Likes
2,344 Views
yadhunandhanan
New Contributor III

Very helpful.

Thanks!

0 Likes
2,344 Views
paulyeo11
Valued Contributor II

Hi HIC

I google i notice that you wrote few article about Dimension , I now face one issue is i like to convert one of my QV table to Qlik Sense. In Qlik View we can make use of ColimnDim to create dynamic  dimension. But in Qlik Sense it does not support ColumnDim. So i want to make use of inline load script , But i try it does not work , hope you can give me some advise on below post :-

How to use inline load to replace ColumnDim ?

Thank you HIC

Paul

0 Likes
2,344 Views
Not applicable

Great explanation. Thanks

0 Likes
2,344 Views
beck_bakytbek
Honored Contributor

very helpful and thanks a lot for sharing

0 Likes
2,344 Views