Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
jim_chan
Specialist
Specialist

Qlik Sense Bar Chart - how to use color by expression?

Hi guys,

I have created a bar chart, with 2 measurements. i want to use different color on these 2 measurements instead of the default color.

1 dimension - Month

this is my measurement 1

count({<Type = {'B'}>}REC_ID)


this is my measurement 2

count({<Type = {'C'}>}REC_ID)


So, add the color - by expression, i want the measurement 1 in green() and measurement 2 in red().


i have failed to do so. please help guys!


Rgds


Jim

1 Solution

Accepted Solutions
Not applicable

Hi Jim

Please see attached.

Here are 3 ways of doing it. - The left bottom is the one i guess you will use.

Please let me know.

Kind Regards

View solution in original post

9 Replies
lironbaram
Partner - Master III
Partner - Master III

hi

currently in Qlik sense , when you use color by expression it is evaluated per dimension and not per expression

you can try this approach

create a new field in the script the has the values meas1,meas2

then in the chart use two dimensions (Month,newfield)

and one expression : if(newfield = 'meas1',count({<Type = {'B'}>}REC_ID),count({<Type = {'C'}>}REC_ID))

now in color bye expression you can use : if(newfield = 'meas1',green(),red())

Not applicable

Hi Jim

Please see attached.

Here are 3 ways of doing it. - The left bottom is the one i guess you will use.

Please let me know.

Kind Regards

jim_chan
Specialist
Specialist
Author

in qlik sense 3.1.4 - the bar chart object only allows you to add in 1 dimension ONLY. another dimension will be categorized as Alternate Dimension. - more like to use it as Cyclic function.

So. when u r saying creating new field and add in into the bar chart, you will be able to see Month and NewField dimension at the X- Axis.

jim_chan
Specialist
Specialist
Author

thanks bro. downloading....

lironbaram
Partner - Master III
Partner - Master III

hi

the bar chart allows two dimensions

i think you are using combo chart

Not applicable

Hi Jim

You may have either 2 expressions and 1 dimension - or 2 dimensions and 1 expression.

You will see if you remove the second expression and you will be able to add another dimension.

Regards

jim_chan
Specialist
Specialist
Author

Hi,

Yes u r correct.  i am using the bottom one.

as for the expression.

Count({<Type = {'A', 'B'}>} RecID) , how to put a description for A and B. Because in the chart when i hover it, looks weird when A = 10 , for example. hwo to make it somethign like, instead of showing A, APPLE = 10 ?

Rgds

Jim

Not applicable

Hi Jim

Please mark my answer as correct.

As for your second question - Please see attached.

Using a mapping load.

Kind Regards

jim_chan
Specialist
Specialist
Author

applymap... i seee... Thanks bro!!!!