Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
prananellutla
Creator
Creator

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
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

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

-Rob

prananellutla
Creator
Creator
Author

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.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Your background color expression would be like:

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

if(dimension1='njk, red(),

blue()

))


-Rob

prananellutla
Creator
Creator
Author

Thankyou Rob , it works.

prananellutla
Creator
Creator
Author

oh yes,it works, thank you. !

prananellutla
Creator
Creator
Author

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
Creator
Creator
Author

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