Qlik Community

Qlik DataMarket Discussions

Discussion Board for collaboration regarding Qlik DataMarket.

nehapathak
New Contributor II

How to add Column Headers

I want structure like below:

          Header 1                                             Header 2

Expression1  Expression2          Expression 3  Expression 4  Expression 5

Can this be achieved with pivot table? If yes kindly give detailed procedure with what expressions need to be used

1 Solution

Accepted Solutions
sth_wch004
New Contributor III

Re: How to add Column Headers

1.JPG

Data load editor

Header:

Load * inline

[

H1, H2

'Header 1','Expression 1'

'Header 1','Expression 2'

'Header 2','Expression 3'

'Header 2','Expression 4'

'Header 2','Expression 5'

]

;

Detail:

Load * inline

[

Number,Expression 1,Expression 2,Expression 3,Expression 4,Expression 5

'1','1','2','3','4','5'

'2','11','12','13','14','15'

'3','21','22','23','24','25'

]

;

Measure:

If(H2 = 'Expression 1', ([Expression 1]),

If(H2 = 'Expression 2', ([Expression 2]),

If(H2 = 'Expression 3', ([Expression 3]),

If(H2 = 'Expression 4', ([Expression 4]),

If(H2 = 'Expression 5', ([Expression 5])

)))))

7 Replies
sth_wch004
New Contributor III

Re: How to add Column Headers

Header:

Load * inline

[

H1, H2

'Header 1','1'

'Header 1','2'

'Header 2','3'

'Header 2','4'

'Header 2','5'

]

;

1.JPG

nehapathak
New Contributor II

Re: How to add Column Headers

Capture.PNG

My query is still not solved as the header name is repeating for every set of measures. I want to apply headers on measures selectively.

arvind_patil
Valued Contributor II

Re: How to add Column Headers

HI Neha,

Please create inline table  for your headers and use this into your pivot table.

Like Below:

INLINEDATA:

Load * inline [

Headers

Header1

Header2

Header3

Header4

];

Thanks,

Arvind Patil

sth_wch004
New Contributor III

Re: How to add Column Headers

1.JPG

Data load editor

Header:

Load * inline

[

H1, H2

'Header 1','Expression 1'

'Header 1','Expression 2'

'Header 2','Expression 3'

'Header 2','Expression 4'

'Header 2','Expression 5'

]

;

Detail:

Load * inline

[

Number,Expression 1,Expression 2,Expression 3,Expression 4,Expression 5

'1','1','2','3','4','5'

'2','11','12','13','14','15'

'3','21','22','23','24','25'

]

;

Measure:

If(H2 = 'Expression 1', ([Expression 1]),

If(H2 = 'Expression 2', ([Expression 2]),

If(H2 = 'Expression 3', ([Expression 3]),

If(H2 = 'Expression 4', ([Expression 4]),

If(H2 = 'Expression 5', ([Expression 5])

)))))

nehapathak
New Contributor II

Re: How to add Column Headers

Hi thanks Chris I am able to segregate the measures but am facing some limitations. Can you tell how to limit the value of a number while applying the condition.

for example,

My expression is sum(revenue), I want the number to be limited to 2 decimal value whereas in other expression I want a whole number

sth_wch004
New Contributor III

Re: How to add Column Headers

Refer Conventions for number and time formats ‒ Qlik Sense

1.JPG

Integer

=Num('123.45','###0') = 123

2 decimals

=Num('123.45','0.00') = 123.45

= Num(Sum([revenue]),'0.00')

nehapathak
New Contributor II

Re: How to add Column Headers

Thanks Chris , It worked.

I have one more question kindly help me out

I want to add Text Color Expression

After first and second selection there should be no change in text color

and after third selection from filter pane, colors should change as per the comparison between first and second selection.

I am using this expression:-

if (count({$}empid) > count({$1}empid) , Red() , Green() )

Community Browser