Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Uploads getting stuck in the virus scanner. We are investigating.
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Contributor III
Contributor III

Qliksense columns based on measures

Hi All,

we want to set the pivot table column, can you help to share some ideas? Sample as below,

zhaohaifeng_1-1594273118677.png

we want to set B and C for '2020YTD' and D for 'Others', how can i do that? Also attached the qvf here. Thanks.

1 Solution

Accepted Solutions
Highlighted
MVP
MVP

Here is the front end solution

Data:
Load * Inline [
A,B,C,D
Frank,23,33,44
Tony,45,66,77,12
Taylor,12,65,34,78
Emily,45,66,88,32
];

In Pivot table Row add column A

In Pivot table Column add below two synthetic dimension

=ValueList('2020YTD','Others')  --> Type

=ValueList('B','C','D')  ---> Measure

Add below measure

=if(ValueList('2020YTD','Others')='2020YTD' and ValueList('B','C','D')='B',
sum(B),
if(ValueList('2020YTD','Others')='2020YTD' and ValueList('B','C','D')='C',
sum(C),
if(ValueList('2020YTD','Others')='Others' and ValueList('B','C','D')='D',
sum(D),0)))

Go to Add-On and uncheck  Include zero values

 

View solution in original post

6 Replies
Highlighted
Creator II
Creator II

hi @zhaohaifeng ,

i hope this is helpful to you.please find attached QVF file.

here is the solution..

 

 

test:
CrossTable (attribute,value,1)
Load * Inline [

A,B,C,D
Frank,23,33,44
Tony,45,66,77,12
Taylor,12,65,34,78
Emily,45,66,88,32
];

NoConcatenate
column:
load A ,
attribute,
value,
if(attribute='B' or attribute='C' ,'2020YTD' ,
if(attribute='D','Others')) as Type
resident test;

drop table test;

 

 

 

Output:

 
 

column measure.JPG

 

 

 

Regards,

raji

Highlighted
Contributor III
Contributor III

Hi @raji6763 

Thanks Raji for your help. It works, but do you know any other ways in the sheet, not in script, as if some expressions need calute in the sheet, it will not work. Can you share some ideas? Thanks in advance.

 

Best Regards,

Haifeng

Highlighted
Specialist III
Specialist III

You can use the below as one of the Dimension.

if(attribute='B' or attribute='C' ,'2020YTD' ,
if(attribute='D','Others'))
Highlighted
Contributor III
Contributor III

Hi @saran7de ,

 

But this attribute still from script, can you share some ideas only from visualization? Thanks

Highlighted
Contributor III
Contributor III

hi @saran7de , @raji6763 

Also shared the sample qvf here, can you help to check and share ideas? Thanks.

Highlighted
MVP
MVP

Here is the front end solution

Data:
Load * Inline [
A,B,C,D
Frank,23,33,44
Tony,45,66,77,12
Taylor,12,65,34,78
Emily,45,66,88,32
];

In Pivot table Row add column A

In Pivot table Column add below two synthetic dimension

=ValueList('2020YTD','Others')  --> Type

=ValueList('B','C','D')  ---> Measure

Add below measure

=if(ValueList('2020YTD','Others')='2020YTD' and ValueList('B','C','D')='B',
sum(B),
if(ValueList('2020YTD','Others')='2020YTD' and ValueList('B','C','D')='C',
sum(C),
if(ValueList('2020YTD','Others')='Others' and ValueList('B','C','D')='D',
sum(D),0)))

Go to Add-On and uncheck  Include zero values

 

View solution in original post