Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
antonbb
Contributor
Contributor

Dynamic list of dimensions in chart table

Dear,

Could you please help me. Is it possible to provide list of dimensions as a table field

Example:

I've dimensions table

ActiveFields:
LOAD * INLINE [
Category, ActiveFields
Fruits,Thickness
Juice,Length
Juice,Thickness
Bread,Width
Bread,Length
Bread,Thickness
];

 

And data:

duplicates:
LOAD * INLINE [
ID, Name,Description,Category,Length,Width,Thickness
1, Apple, Apples, Fruits, ,,12
2, Orange, Orange, Fruits, ,,12
3, Juice, Juice, Juice, 10,,12
4, Bread, Bread, Bread, 10,11,12
5, Baget, Baget, Bread, 10,11,
5, Baget2, Baget2, Bread, 10,11,
5, Baget3, Baget3, Bread, 10,11,
];

 

I need to show only relevant characteristics in chart table.

I can do that but i need to provide all dimensions as 

Name

Category

=$(=if (LEN(SubField(Concat(DISTINCT ActiveFields, '|'), '|',1))>0,'['&SubField(Concat(DISTINCT ActiveFields, '|'), '|', 1)&']'))

=$(=if (LEN(SubField(Concat(DISTINCT ActiveFields, '|'), '|',2))>0,'['&SubField(Concat(DISTINCT ActiveFields, '|'), '|', 2)&']'))

=$(=if (LEN(SubField(Concat(DISTINCT ActiveFields, '|'), '|',3))>0,'['&SubField(Concat(DISTINCT ActiveFields, '|'), '|', 3)&']'))

 

In real case i've about up to 40 different dimension for different objects. So it is a little difficult to enter each dimension one by one.

 

So may be there is some way to provide list of dimensions in one simple string.

 

I've attach example document

 

 

1 Solution

Accepted Solutions
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this:

 

CrossTable([ActiveFields],Value,4)
duplicates:
LOAD * INLINE [
ID, Name,Description,Category,Length,Width,Thickness
1, Apple, Apples, Fruits, ,,12
2, Orange, Orange, Fruits, ,,12
3, Juice, Juice, Juice, 10,,12
4, Bread, Bread, Bread, 10,11,12
5, Baget, Baget, Bread, 10,11,
5, Baget2, Baget2, Bread, 10,11,
5, Baget3, Baget3, Bread, 10,11,
];
exit script;

ActiveFields:
LOAD * INLINE [
Category, ActiveFields
Fruits,Thickness
Juice,Length
Juice,Thickness
Bread,Width
Bread,Length
Bread,Thickness
];

 

 

Switch your table to a pivot table, drag ActiveFields to the top of the columns:

MC.PNG

Refer attached qvw as reference.

Thanks and regards,
Arthur Fong

View solution in original post

1 Reply
Arthur_Fong
Partner - Specialist III
Partner - Specialist III

Try this:

 

CrossTable([ActiveFields],Value,4)
duplicates:
LOAD * INLINE [
ID, Name,Description,Category,Length,Width,Thickness
1, Apple, Apples, Fruits, ,,12
2, Orange, Orange, Fruits, ,,12
3, Juice, Juice, Juice, 10,,12
4, Bread, Bread, Bread, 10,11,12
5, Baget, Baget, Bread, 10,11,
5, Baget2, Baget2, Bread, 10,11,
5, Baget3, Baget3, Bread, 10,11,
];
exit script;

ActiveFields:
LOAD * INLINE [
Category, ActiveFields
Fruits,Thickness
Juice,Length
Juice,Thickness
Bread,Width
Bread,Length
Bread,Thickness
];

 

 

Switch your table to a pivot table, drag ActiveFields to the top of the columns:

MC.PNG

Refer attached qvw as reference.

Thanks and regards,
Arthur Fong