Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

prananellutla
Contributor

color by expression using a dimension not showing in the chart?

Hi is there a way I can write an expression using a dimension iam not showing in the chart?

For Example :

 

col1(dimension1)col2(dimension2)measure
njkabc2.3
njkuio5.6
rbjoip7.8
xyznji9
xyzkji8.9
xyzlpo7.6

col1 and col 2 are related data but iam only using col2(dimension1)) in my bar chart. Iam sorting descending on measure

But I want to color the exprssion by col1(dimension1)

expression:

if(dimension1='xyz' then green, ...n so on....)

colnp1.jpg

thanks

Prana

7 Replies

Re: color by expression using a dimension not showing in the chart?

Yes, you can reference fields not in the chart in your backgrouund color expression.

-Rob

prananellutla
Contributor

Re: color by expression using a dimension not showing in the chart?

Hey Rob thanks for your reply, sorry I didn't understand clearly. you are saying its possible and I should be writing a code on the not in color/legend area?

do you mind giving me an example file on where to write the code? and how.

Re: color by expression using a dimension not showing in the chart?

Hi,

Your background color expression would be like:

if(dimension1='xyz', green(),

if(dimension1='njk, red(),

blue()

))


-Rob

prananellutla
Contributor

Re: color by expression using a dimension not showing in the chart?

Thankyou Rob , it works.

prananellutla
Contributor

Re: color by expression using a dimension not showing in the chart?

oh yes,it works, thank you. !

prananellutla
Contributor

Re: color by expression using a dimension not showing in the chart?

Just one more qn , It works fine when I use data items with no spaces (POC,Area).If I use the fields which have spaces it is not working. (Field History). my varaible defination is ,

va1.jpg

result:

ex1.jpg

prananellutla
Contributor

Re: color by expression using a dimension not showing in the chart?

‌apologies - I just realized I posted this on the wrong window

Community Browser