Skip to main content
Announcements
Qlik Community Office Hours, March 20th. Former Talend Community users, ask your questions live. SIGN UP

How to use - Dimensionality()

cancel
Showing results for 
Search instead for 
Did you mean: 
robert_mika
Master III
Master III

How to use - Dimensionality()

Last Update:

Feb 19, 2015 6:16:57 AM

Updated By:

robert_mika

Created date:

Feb 19, 2015 6:16:57 AM

Attachments

Definition:


Returns the number of dimension columns that have non-aggregation content. i.e. do not contain partial sums or collapsed aggregates.

A typical use is in attribute expressions, when you want to apply different cell formatting depending on aggregation level of data.

This function is only available in charts. For all chart types except pivot table it will return the number of dimensions in all rows except the total, which will be 0.

What does it mean?

We have Table with 4 dimensions(columns): Product,Category,Type,Sales

table.jpg

Now we want to create Pivot Table by using those Dimensions.

We are going to use only 3 of them(Product,Category,Type) and use 4th(Sales) in our expression.

The result is shown below:

This Pivot Table  has 3 dimensions so its maximum dimensionality is 3.

For better understating please see  table below.

The function is used to show on which dimensionality level each of the Pivot Table row is:

'Sugar' has dimensionality of 1 which is Total for that 'Product'.

'Salt' has dimensionality of 2 which is Total for each 'Category' of that 'Product'.

'Oil' has dimensionality of 3 which is single value for each 'Type' of the 'Product's' 'Category'.

So then more Dimension we use the greater dimensionality of our Pivot Table is.


Practical use:

1) To show the level of dimensionality:

Expression:

if(Dimensionality()=1 ,RGB(151,255,255),if(Dimensionality()=2 ,RGB(0,238,0),if(Dimensionality()=3,RGB(255,130,171))))

2) Highlight background of rows which on each level  fall into certain condition:

Expression:

if(Dimensionality()=1 and sum(Sales)<150,RGB(151,255,255),if(Dimensionality()=2 and sum(Sales)<=20,RGB(0,238,0),if(Dimensionality()=3 and Sum(Sales)<=20,RGB(255,130,171))))

LEVEL1 --> Values <140LEVEL 2 --> Values <=20LEVEL 3 --> Values <=20

Remember ligtbulb.jpg

  • To use the script below the Excel file must be saved in the same folder that your qvd file

        Otherwise you will need to make changes the this path - [Dimensionality.xlsx]

Directory;

LOAD Product,

     Category,

     Type,

     Sales

FROM

[Dimensionality.xlsx]

(ooxml, embedded labels, table is Sheet1);

Felling Qlingry?

How To /Missing Manual (25 articles)

Comments
saurabh5
Creator II
Creator II

Nice way of explaning dimenssionality, helpful topic !

NickHoff
Specialist
Specialist

Is it possible to hide a total and still show the dimension, which makes up that total?

senarath
Creator III
Creator III

Any other business uses other than cell formatting ?

Thanx

vikasmahajan

Actually from many days we have requirement of such types of presentations in our charts

Thanks for Sharing such nice document.

Vikas 

Anonymous
Not applicable

I think this is mainly for the busines user

richard_chilvers
Specialist
Specialist

A clear explanantion of a feature which is kind of hidden away but can be vaulable especially when formatting cells as highlighted here.

rustyfishbones
Master II
Master II

This is the best explanation I've seen on this, thanks.

Not applicable

Very Useful for Pivot..great

Not applicable

Nice post! I've also found Dimensionality() useful when there's a requirement to calculate the total row in a different way than the other rows.

Not applicable

VERY HELPFUL BUT still in doubt,  how come it got 1 dimentionality for sugar

Version history
Last update:
‎2015-02-19 06:16 AM
Updated by: