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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Custom Colors By Measure In Bar Chart

I am trying to have each bar in the graph be represented by a different color.

I am in Appearance, set Colors to "Custom" and "checked" The expression is a color code"

I wrote the following expression:

if(ValueList('Conclusive','Inconclusive', 'Partially Conclusive')='Conclusive'

     ,rgb(64,3,95)

     ,if(ValueList('Conclusive','Inconclusive', 'Partially Conclusive')='Inconclusive'

        ,rgb(0,0,192)

        ,rgb(192,250,60)

     )

)

It is defaulting all 3 bars to the last else color... rgb(192,250,60)

Please advise...

Thanks

David

23 Replies
mgranillo
Specialist
Specialist

is your dimension ValueList('Conclusive','Inconclusive', 'Partially Conclusive')  ?

It will need to be this for the my color expression to work.

sunny_talwar

Check here, it seems to be working:

Capture.PNG

Expression:

Pick(Match(

ValueList('Conclusive','Inconclusive', 'Partially Conclusive'), 'Conclusive','Inconclusive', 'Partially Conclusive'),

rgb(64,3,95), rgb(0,0,192), rgb(192,250,60))

Not applicable
Author

How do I find it?  I am running Qlik Sense.

sunny_talwar

Did you look at my response below? I attached a .qvf file for you to check out

Not applicable
Author

Sunny,

I am really not sure what is going on. I downloaded your .qvf and it ran on my system. I then copied the expression and pasted it in my sheet and nothing happened. I am running Qlik Sense using my browser, so I am not sure how I can get you my .qvf  file so you can see exactly what is happening.

I attached a screen shot as to what it looks like after I inserted your expression.

Please advise...

Thanks

David

sunny_talwar

What is the dimension you are using in the chart?

Not applicable
Author

Sunny,

I realized that I needed to add ValueList('Conclusive','Inconclusive','Partially Conclusive') to my dimension function under Data.  This allowed me to get the three different colors.

I then added the pick(match() function in the expression section under measures.  It then makes all my bars the same height which is not correct.

Any ideas?

I attached a screen shot and excel spreadsheet with the data.

I feel I am getting closer...

As always thanks for your help...

David

sunny_talwar

You probably need Pick(Match()) for your expression as well. What was your expression before? and dimension before? I think You should do this:

Pick(Match(DimensionName, 'Conclusive','Inconclusive', 'Partially Conclusive'),

rgb(64,3,95), rgb(0,0,192), rgb(192,250,60))

Not applicable
Author

I am a little confused, as I am pretty new to all of this....

Under the data section for measure... I have:

Pick(Match(ValueList('Conclusive','Inconclusive','Partially Conclusive'), 'Conclusive','Inconclusive','Partially Conclusive'), rgb(64,3,95), rgb(0,0,192), rgb(192,250,60))

Under the data section for dimension... I have:

ValueList('Conclusive',Inconclusive','Partially Conclusive')

Currently does not work this way...

Have you been able to get it to work with the spreadsheet I gave you?

Do I need to change what I have under Data -> Dimension...

Thanks

mgranillo
Specialist
Specialist

David,

You should have one expression.  Use the same pick match function provided but replace the colors with each of your expressions.