Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
acrodrigues03
Partner - Contributor III
Partner - Contributor III

Color By Expression for one dimension

Hi All!

I have a pie chart only with one dimension that is:

=IF([Channel]='A','1',

IF([Channel]='B' or

[Channel]= 'C' or

[Channel]='D' ,

'2',

IF([Channel]='E' or

[Channel]= 'F' or

[Channel]='G' ,

'3',)))

So my pie chart has 3 sections: 1,2 and 3.

I want to define the colors for each section. How can I do that?

Thank you in advance!

Carina

5 Replies
acrodrigues03
Partner - Contributor III
Partner - Contributor III
Author

I need to do this with set analysis

Anonymous
Not applicable

You could create a Master Item using your Channel dimension and assigned colours to values :

https://help.qlik.com/en-US/sense/September2017/Subsystems/Hub/Content/Colors/assigning-colors-to-di...

acrodrigues03
Partner - Contributor III
Partner - Contributor III
Author

Hi Bill!

Thank you for your fast response! Unfortunately I need to define them outside of the master items with set analysis

Anonymous
Not applicable

In the properties panel go to:

  • Appearance
  • Colors abnd legengen
  • Colors:  Customs & By expression
  • For Expression

Use an expression something like

if ( equipment_owner = 'Leased' , green() , yellow() )


You can use whatever expression suits your needs.

lcontezini
Partner - Creator
Partner - Creator

Create the dimension in your script, then you colour your graph by expression, using the new dimension, like:

if(new_dimension=1,blue(),

if(new_dimension=2,green(),red()))