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: 
schmidtj
Creator II
Creator II

Qlik Sense - Dynamic coloring

Hi,

i'm making my first steps with Qlik Sense and i'm having trouble with dynamic coloring of my bar chart.

I have a dummy bar chart with one dimension (ACTION) and two integer values '(THIS_WEEK)' and '(THIS_WEEK) - (LAST_WEEK)'.

The last value is calculated as a formular as can be seen above.

What i want to do:

Value '(THIS_WEEK)' is supposed to have a fixed color value.

The formular value is supposed to be red when < 0 and green when > 0.

I cant really believe that setting specific dynamic color values cant be done using the gui but well ...

I have red some other threads here and i cant really get it to work. My color formular is always being applied to both values but i would like

to apply one for one value and one for the other value.

Can somebody help me with this?

Thanks in advance.

1 Solution

Accepted Solutions
thomaslg_wq
Creator III
Creator III

So, in dimensions (so 2 dimensions)

1 : ACTION

2 : valuelist('Week','DiffWeek')

In measure (only one)

if(valuelist('Week','DiffWeek')='Week',sum([THIS_WEEK]),sum([THIS_WEEK]) - sum([LAST_WEEK]))

In color expression

if(valuelist('Week','DiffWeek')='Week',YOUCOLOR1,YOURCOLOR2)

View solution in original post

6 Replies
thomaslg_wq
Creator III
Creator III

Maybe you should look at the valuelist() function.

For example (for you to understand how it works)

Put in dimension :

valuelist('FirstValue','SecondValue')

Put in Expression:

if(valuelist('FirstValue','SecondValue')='FirstValue', 10000,2000)

put in color expression:

if(valuelist('FirstValue','SecondValue')='FirstValue', red(),green())

schmidtj
Creator II
Creator II
Author

Hi,

thanks for the reply.

I'm afraid i still dont get the logic behind it.

I still dont see how this helps me when trying to apply the colors to my two measures separately.

How exatcly to i adress my 2 measures to appply the color?

thomaslg_wq
Creator III
Creator III

This case allows you to create an only one measure, separated by the dimension value that you created out of the model. So you can apply different colors to the different dimensions (so the different expressions).

Did you try it ?

schmidtj
Creator II
Creator II
Author

No, because i dont understand it im afraid.

I dont know how to adapt your code so it works.

Im in the formular textarea of my bar chart in the tab fpr colors and legend.

How exatcly would by formular look like to achieve my color logic when i have two measure like this:

- sum([THIS_WEEK])

- sum([THIS_WEEK]) - sum([LAST_WEEK])

thomaslg_wq
Creator III
Creator III

So, in dimensions (so 2 dimensions)

1 : ACTION

2 : valuelist('Week','DiffWeek')

In measure (only one)

if(valuelist('Week','DiffWeek')='Week',sum([THIS_WEEK]),sum([THIS_WEEK]) - sum([LAST_WEEK]))

In color expression

if(valuelist('Week','DiffWeek')='Week',YOUCOLOR1,YOURCOLOR2)

schmidtj
Creator II
Creator II
Author

Ok i got it to work now having differnt colors for my two measures.

Im a bit shocked though what is needed to achieve this - i need to adjust my dimension and measure setup just to

apply dynamic colors?

I really hope this is not the only way but thanks a lot so far.

It solved my problem but i really hope there is an easier way ...

Thanks anyhow!